Several people have asked for this recently on the Win32 lists:
probably not worth putting on CPANl or is it?  

Any ideas?

lee

=head1 &move_dir

Move the specified directory tree to the specified directory.

Author:   Lee Goddard (additions by $Bill Luebkert)
Requires: File::Copy
Accepts:  Two scalars representing paths to the source and destination dirs.
Returns:  Nothing.
Eg. 

        move_dir("D:/www/sussexjewishnews","D:/www/sussexjewishnews/_archives/test");

=cut

use File::Copy;

sub move_dir { my ($source, $destination) = (shift, shift);
        die "Sub move_dir requires a source dir!" if not $source;
        die "Sub move_dir requires a destination dir!" if not $destination;
        local *DIR;
        chdir $source or die "Sub move_dir couldn't cd to dir <$source>:\n$!";
        opendir DIR, "." or die "Sub move_dir couldn't open process dir: <$dir2check>:
$!\n";

        foreach ( readdir DIR ) {
                next if /^\.{1,2}$/;
                if (-d){
                        &move_dir ("$source/$_", "$destination/$_");
                } else {
                        print "Move $source/$_ to $destination/$_\n";
                        move("$source/$_","$destination/$_");

                }
        }
        closedir DIR;
}



-- 

Lee Goddard     <[EMAIL PROTECTED]>
-------------------------------------
Perl : XML : XSLT : XHTML / JS : Java

"Post-modernism....the meta-narrative that denies meta-narrative."
                                           - Cedric Watts, Sussex 1997

Reply via email to