vcherubini
Programmer
Hello:
I have a question about copying files.
I have many CD's full of files with a certain extension. I want to search the CD's, each directory and their subdirectories, for all files with the extension .lwo and then copy the file to a folder called Temp on my C:/ drive.
How would I do this?
I have some code that I have written, but it does not work:
[tt]
use File::Copy;
$i=0;
sub g {
foreach (glob "$_[0]/*"
{
-d && g($_) unless -l;
opendir(D,"$_[0]"
;
while ($file = readdir(D)) {
#print "$file\n";
#getc;
if (($file eq "."
|| ($file eq ".."
) {
# do nothing
} else {
if ($file =~ m/\w+.?\w\.lwo/gi) {
copy("$file","$file"
;
}
}
}
close(D);
}
}
g("F:"
;
[/tt]
This, however, does not work. Can anyone shed some light?
Thanks,
-Vic vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
I have a question about copying files.
I have many CD's full of files with a certain extension. I want to search the CD's, each directory and their subdirectories, for all files with the extension .lwo and then copy the file to a folder called Temp on my C:/ drive.
How would I do this?
I have some code that I have written, but it does not work:
[tt]
use File::Copy;
$i=0;
sub g {
foreach (glob "$_[0]/*"
-d && g($_) unless -l;
opendir(D,"$_[0]"
while ($file = readdir(D)) {
#print "$file\n";
#getc;
if (($file eq "."
# do nothing
} else {
if ($file =~ m/\w+.?\w\.lwo/gi) {
copy("$file","$file"
}
}
}
close(D);
}
}
g("F:"
[/tt]
This, however, does not work. Can anyone shed some light?
Thanks,
-Vic vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====