aboutsummaryrefslogblamecommitdiffstats
path: root/rename-journal-files.pl
blob: 24dc712c34bdacc0f13383c2c624282a4ca0f336 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
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);