From f11b2bdd214c74b7a2aedb0516a22db25e95a2c3 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 25 Apr 2023 13:45:47 +0100 Subject: added file --- rename-journal-files.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 rename-journal-files.pl 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); + -- cgit v1.2.3