aboutsummaryrefslogtreecommitdiffstats
path: root/rename-journal-files.pl
diff options
context:
space:
mode:
Diffstat (limited to 'rename-journal-files.pl')
-rw-r--r--rename-journal-files.pl13
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);
+