| [reply] |
$ (cd $srcdir; tar cf - *) | (cd $dstdir; tar xf -)
But that's not entirely perlish. For large amounts of copying (large files, large numbers of files), it may be more efficient to do this simply because then you don't need to do much, and the overhead of forking and setting up pipes is greatly minimised by the actual work. For small numbers of files in small numbers of directories, it's probably still worth it simply to avoid development effort.
(cf File::DirSync which looks really cool, but if you're not syncing but actually just copying from source to destination, and am not going to need to resync it later, may be a bit of an overkill.) | [reply] [d/l] |
You want to copy directory recursively.
See File::NCopy.
...
copy \1,"directory1","directory2"
...
| [reply] [d/l] |
To me (YMMV) question is ambiguous (to be charitable; UNclear to be precise).
But for starters, why would you use perl rather than Command Line utilities such as cp or mv (*n*x) or move (DOS) or (if on windoze) drag'n'drop using file manager?
and, to my eyes, the second question doesn't make a lot of sense, unless you either mean -- move all the files in a root (/ or c:\) and its directories to "another directory" for backup or somesuch while the factual statement between the two questions seems to suggest you may be talking about a non-root directory.
apologies if I'm being dense, but consider that good precise questions are likely to get the best answers. Please update (Tank points out that since you're an annoymous monk, you'll have to reply or "comment") to clarify! | [reply] |