Created
January 11, 2011 13:13
-
-
Save thinkhy/774395 to your computer and use it in GitHub Desktop.
CopyFile_Perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################################################################### | |
# Description: Copy error files to another directory | |
# Usage: | |
# Creator: thinkhy | |
# Date: 2010.01.13 | |
#################################################################################### | |
use strict; | |
use warnings; | |
use Cwd; | |
use File::Copy; | |
open IN, "<error.txt"; | |
while(<IN>) | |
{ | |
print $_."\n"; | |
my $filename = $_; | |
chomp($filename); | |
$filename =~ s/\//\\/g; | |
my($dirpath,$basename,$extname) = ($filename =~ /^((?:.*[:\\\/])?)(.*)(\.[^.]*$)/s); | |
#$filename = "\"".$filename."\""; | |
my $curdir = getcwd; | |
$curdir =~ s/\//\\/g; | |
my $dst = $curdir."\\出错图片\\$basename".$extname; | |
$dst =~ s/[\r\n]//g; | |
copy $filename, $dst | |
or warn "从\"$filename\"拷贝到\"$dst\"出错\n"; | |
} | |
close IN; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment