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).
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.
Peace,
Marsie
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]