#!/usr/bin/perl # Usage: perl minutes.pl # # Place new minutes files into this directory before running. # A preview of commands to be run will be shown. # Either press enter to run the commands or ctrl-c to get out. # # Don't forget to update the HTML files after (one level up). my @files = (<*.txt>, <*.doc>, <*.docx>, <*.pdf>); my $cmds = ''; foreach my $file (@files) { my ($root, $ext) = split(/\./, $file); my ($year, $mon, $day, @rest) = split(/_/, $root); my $date = "$year$mon$day"; my $author = $date > 20040323 ? 'mikelabonte' : 'bobhaller'; my $title = "Minutes for the $mon-$day-$year ibis-quality meeting"; my @existing = <"$date/*/$title">; if(@existing) { print "File $file already exists\n"; } else { $cmds .= "mkdir -p '$date/$author/$title'\n"; $cmds .= "mv -i $file '$date/$author/$title'\n"; } } print "Commands to run:\n$cmds\n"; print "Enter to run these commands or CTRL-C to abort\n"; my $resp = ; print `$cmds`;