yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | my $folder_path = $ARGV[0];
|
| 2 | my $file_postfix = $ARGV[1];
|
| 3 |
|
| 4 | my $strFileList;
|
| 5 | if(-d $folder_path)
|
| 6 | {
|
| 7 | print "[BIN FOLDER]\n";
|
| 8 | opendir (DIR, $folder_path) or die "Error: cannot open folder: $folder_path";
|
| 9 | @files = grep {/.+_GFH/i} readdir DIR;
|
| 10 | close DIR;
|
| 11 |
|
| 12 | foreach (@files)
|
| 13 | {
|
| 14 | $ori_name = $_;
|
| 15 | $_ =~ s/_GFH//i;
|
| 16 | rename("$folder_path/$ori_name", "$folder_path/$_") or die "Error: fail to rename $ori_name to $_\n";
|
| 17 | $strFileList .= "$folder_path/$_\n";
|
| 18 | }
|
| 19 |
|
| 20 | }
|
| 21 | else
|
| 22 | {
|
| 23 | print "[BIN FILE]\n";
|
| 24 | $strFileList .= "$folder_path\n";
|
| 25 | }
|
| 26 |
|
| 27 | print $strFileList;
|
| 28 | exit 0;
|