grashoper has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use file:copy:recursive to move files, I want to remove the original files, but I would like to keep the directories, what did I do wrong here, the documentation for this is really confusing to me. it blew out my entire directory tree, I just want to move the files. I guess I should have used fmove but I don't understand this doc at all. can someone say this in english I don't get it, I read 3 or 4 times it doesn't make any sense all I get is blah blah blah. fcopy() This function uses File::Copy's copy() function to copy a file but not a directory. Any directories are recursively created if need be. One difference to File::Copy::copy() is that fcopy attempts to preserve the mode (see Preserving Mode below) The optional $buf in the synopsis if the same as File::Copy::copy()'s 3rd argument returns the same as File::Copy::copy() in scalar context and 1,0,0 in list context to accomidate rcopy()'s list context on regular files. (See below for more info)??
use File::Copy::Recursive; use File::Find; use File::Copy; #use strict; $Verbose; my $srcdir='c:\\inetpub\\performancetesting\\output\\new\\mlx\\'; my $destdir='c:\\mlx\\'; File::Copy::Recursive::dirmove $srcdir, $destdir or die "Copy failed: +$!"; print "done copying";

Replies are listed 'Best First'.
Re: move files without blowing out directories
by ww (Archbishop) on Apr 28, 2009 at 18:28 UTC
    I guess you should read the doc, which expands on this from the CPAN README:
    File/Copy/Recursive version 0.38 ================================ This module has 3 functions, one to copy files only, one to copy direc +tories only and one to do either depending on the argument's type.
Re: move files without blowing out directories
by ikegami (Patriarch) on Apr 28, 2009 at 18:51 UTC

    For heaven's sake, link to the docs instead of copying them minus the formatting.

    And file:copy:recursive doesn't exist. It's not even a legal module name. Why do you make us do so much work to help you?

    I think File::Copy::Recursive doesn't do what you want.

Re: move files without blowing out directories
by ramrod (Priest) on Apr 28, 2009 at 18:28 UTC
    Sounds good. Try move:
    use File::Copy; move("/dev1/fileA","/dev2/fileB");

    Update: Added link . . .
    . . . I got yelled at. :)