[Gllug] Changing case on filenames
Chris Ball
chris at void.printf.net
Wed Mar 6 12:13:39 UTC 2002
>>>>> "Harry" == Harry Jackson <Jackson> writes:
>> #!perl -w opendir(DIR, "/path/to/dir"); @files = readdir(DIR);
>> foreach $file (@files) { rename($file, (lc $file)); }
Harry> I cannot figure out why you have to be in the same directory
Harry> if you have already opened it in the script or am I doing
Harry> something wrong.
Ah, hadn't thought of that. While the dir's being opened with the full
path, the @files array is populated with readdir(), which is just going
to push the bare filenames from the directory handle. Probably fixed
with a chdir("/path/to/dir"); anywhere before the foreach loop.
- Chris.
--
$a="printf.net"; Chris Ball | chris at void.$a | www.$a | finger: chris@$a
"In the beginning there was nothing, which exploded."
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list