In article <36**************************@posting.google.com >, yaduraj
<ya******@yahoo.com> wrote:
hello all,
How can i copy files with a particular extension.
For eg:
I am using
copy ("$HOME_DIR/file1.txt" ,"$LOCAL_DIR/") or warn "Cannot copy file:
$!";
to copy a file, but if i have to copy all the files with the extension
*.txt how do i do it...
Perl doesn't have a built-in copy function, so you must be using
File::Copy, If you were to post a complete, minimal program that
demonstrates your problem, people trying to help you wouldn't have to
guess about the details.
To apply a function to different files, check out the glob function or
the File::Find module. You probably want to wrap your copy command in a
loop of some sort, because perl doesn't know whether you want to copy
the each file to a file of the same name in a different directory, or
to a different name in the same directory, or copy all of the files to
a single, concatenated file. You will have to tell it.
FYI: this newsgroup is defunct; try comp.lang.perl.misc in the future.