in reply to Copying a directory and its contents while displaying a status

Wow.

Really wow.

This does work, but at first it really seemed to me like it couldn't work. I didn't understand it yesterday, didn't understand it today, even downvoted it, got suspicious when I saw its noderep, tried to write a reply where I argue how this can't possibly work, and only understood how it could work during that. So I downloaded the cpan module, tested it, and it worked.

It might have been better if you wrote a bit more comments about it.

For anyone else puzzled, this overrides a private function from the File::Copy::Recursive cpan module. That function is called recursively on each file so this overriding code can print a debug output saying what file is copied. The title is confusing, because it doesn't actually display a progress bar, only prints the name of each file as it's copied. You use the code by calling the dircopy function with a source and target directory name.

Update: By the way, I won't use this code, because I don't seem to ever need copying files recursively from a script, and because cp -av works well enough.

  • Comment on Re: Copying a directory and its contents while displaying a progress bar

Replies are listed 'Best First'.
Re^2: Copying a directory and its contents while displaying a progress bar
by hiseldl (Priest) on Aug 08, 2008 at 02:14 UTC

    Thank you for the feedback. I have changed the title a bit, so it is not so misleading, and I have added more comments about this snippet to include an example using Hook::LexWrap.

    An example problem that this is a solution for, is that a user wants to plug in their USB drive and they want to copy their files to their PC. So, to be user friendly, you could use this snippet as a basis for showing progress while files are getting copied. You could insert Tk progressbars, show remaining bytes, etc.

    --
    hiseldl
    What time is it? It's Camel Time!