> -----Original Message-----
> From: Simopoulos [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 15, 2002 2:19 PM
> To: [EMAIL PROTECTED]
> Subject: Newbie Stupid Question!
>
>
> Hi All,
> I'm a newbie just starting out learning Perl.
> My problem is I have a bunch of files that are (.doc) files,
> and I want to rename
> the files (.data).
> I also want move then to another directory, but I don't
> really want to destroy or
> change the old ones (.doc).
Then you need to copy the files, not move them.
> What I've done so far doesn't work the way I want it to. It is:
>
> #! /usr/bin/perl -w
> opendir(DOCUMENTS,".") || die "Can't open directory documents!";
> @filenames = readdir(DOCUMENTS);
> closedir(DOCUMENTS);
> foreach $filename(@filenames) {
> if ($filename =~ m/\.doc$/i) {
> rename($filename, "/home/marsie/data/$filename.dat") ||
> die "Can't move files";
> } else {
> print "Not a .doc file!\n";
> }
> }
>
> I would appreciate any help anyone can offer.
You really should use the standard File::Copy module, IMO.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]