diff options
author | Matthew Lemon <y@yulqen.org> | 2023-04-25 13:45:47 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-04-25 13:45:47 +0100 |
commit | f11b2bdd214c74b7a2aedb0516a22db25e95a2c3 (patch) | |
tree | 656e1a7fa3670c960e9a88a1bf71c149763a53ec | |
parent | 680216be8bcb4cf13f1621f1f0459c771fdda814 (diff) |
added file
-rw-r--r-- | rename-journal-files.pl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rename-journal-files.pl b/rename-journal-files.pl new file mode 100644 index 0000000..24dc712 --- /dev/null +++ b/rename-journal-files.pl @@ -0,0 +1,13 @@ +#!/usr/bin/env perl + +opendir(DIR, ".") || die "Can't open directory: $!\n"; + +while (my $file = readdir(DIR)) { + if ($file =~ /(\d{4})_(\d{2})_(\d{2})\.md$/) { + my $new_name = "$1-$2-$3.md"; + rename($file, $new_name) || die "Can't rename file '$file': $!\n"; + } +} + +closedir(DIR); + |