in reply to Renaming Directories

You could move the directory wholesale from the shell, as in
$>mv old_name new_name
If you're on *nix.

If you're bent on a Perl solution - use the portable (and already installed) File::Copy module.
Ripped verbatim from File::Copy's POD:

use File::Copy; copy("file1","file2"); copy("Copy.pm",\*STDOUT);' move("/dev1/fileA","/dev2/fileB");
Obviously, you'll want the move() function.

Incidentally, you may wish to try typing "Renaming" in the search box at the top of every page next time.

Update: Whoops. I missed the fact that you could do a straight rename("OLDNAME", "NEWNAME"); My bad
Update 2: Aristotle++ Don't use the rename() - its abilities vary from system to system. read

perldoc -f rename
for the full info.

cheers
davis
Is this going out live?
No, Homer, very few cartoons are broadcast live - it's a terrible strain on the animator's wrist

Replies are listed 'Best First'.
Re^2: Renaming Direcotries
by Aristotle (Chancellor) on Jun 26, 2002 at 16:22 UTC
    I missed the fact that you could do a straight rename("OLDNAME", "NEWNAME");
    Careful. That will not work across filesystems. Otherwise, ++

    Makeshifts last the longest.

        And in that case, neither would system "mv"....
        Hmmm, my docs (v5.6.1) disagree. From perldoc -f rename
        Behavior of this function varies wildly depending on your system implementation. For example, it will usually not work across file system boundaries, even though the system mv command sometimes compensates for this.

        davis
        Is this going out live?
        No, Homer, very few cartoons are broadcast live - it's a terrible strain on the animator's wrist
Re: ^2 Renaming Direcotries
by lemming (Priest) on Jun 26, 2002 at 17:52 UTC

    One concern that no one has mentioned yet:
    Error Checking:

    1. Check to make sure you're not going to clobber an existing file or directory
    2. Is the file that is renamable movable?
    3. Is the directory that you'll be working in writable?
    4. etc...
    Check your results and what you're planning to do, otherwise you might have some tedious devugging to do.