Nevermind, I figured it out.
I'm only passing the file name in the rename script, I had to add the whole
path to it.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 1:42 PM
To: [EMAIL PROTECTED]
Subject: Renaming Files Help
I keep getting an error when I run this script -
No such file or directory.
What am I missing?
#!/usr/bin/perl -w
#rename
use File::Find;
$DIRLIST = ('D:\PATH\To-Be Model\Data');
find(\&process_file, $DIRLIST);
rename_files();
sub process_file{
push (@files, $_);
};
sub rename_files{
foreach $file (@files) {
$newname = $file;
$newname =~ s/(.*)\.txt/$1\.dat/;
rename($file, $newname) or
warn "Couldn't rename $file to $newname: $!\n";
}
};
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]