#!/usr/bin/perl use strict; use warnings; my $base_dir = "C:/Documents/perl"; while (my $line = ) { chomp $line; next if $line =~ /^\s*\#/; # next if not $line; my ($filename, $filepath) = split '\t', $line; if (not -d "$base_dir/$filepath") { system "c:/cygwin/bin/mkdir -p $base_dir/$filepath"; print "Made $base_dir/$filepath\n"; } if (not $filename) { warn "Filename is blank, filepath is [$filepath], line is [$line]\n"; } else { system "mv $base_dir/$filename.xls $base_dir/$filepath"; print "Moved $base_dir/$filename.xls to $base_dir/$filepath\n"; } print "\n"; } __DATA__ filename1 some/file/path filename2 some/other/file/path filename3 yet/another/file/path/oooh/this/one/is/long #### Made C:/Documents/perl/some/file/path Moved C:/Documents/perl/filename1.xls to C:/Documents/perl/some/file/path Use of uninitialized value in concatenation (.) or string at C:\Documents\perl\try.pl line 15, line 2. Use of uninitialized value in concatenation (.) or string at C:\Documents\perl\try.pl line 21, line 2. Filename is blank, filepath is [], line is [] Made C:/Documents/perl/some/other/file/path Moved C:/Documents/perl/filename2.xls to C:/Documents/perl/some/other/file/path Use of uninitialized value in concatenation (.) or string at C:\Documents\perl\try.pl line 15, line 4. Use of uninitialized value in concatenation (.) or string at C:\Documents\perl\try.pl line 21, line 4. Filename is blank, filepath is [], line is [] Made C:/Documents/perl/yet/another/file/path/oooh/this/one/is/long Moved C:/Documents/perl/filename3.xls to C:/Documents/perl/yet/another/file/path/oooh/this/one/is/long