in reply to Copying all files and subdirectories from one directory to another..
I think you want the "tar" utility, especially if you're working on a unix system (GNU tar has been ported to windows, and so has the GNU bash shell, which would also be necessary here, but the usage suggested below may have some problems on a windows system, especially if the source directory tree contains a large quantity of data, e.g. 100's of MB or more, depending on your system's disk capacity).
The usage you'd want goes like this:
That is, you set your current working directory to be the place where you want to put a copy of the source data. Then run a two-command sequence in a "group": cd to the path containing the source directory, and run tar to create a tar file containing the source tree; the "name" of the "tar file" is "-" (dash), which tar interprets as stdout. The output of this command sequence is then piped to another tar command, this one running in the destination path, and extractin data from the tar file that is given to it; in this case, the "tar file name" (dash) represents stdin.cd destination_parent (cd source_parent; tar cf - source) | tar xf -
This will tend to run a lot faster (and is a lot easier and more robust) than any Perl script could possibly be. There are also tons of options for controlling tar's behavior: which files or subdirectories to include or exclude, based on names, dates, types, owners, etc. (The manual page for tar is rather large.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Copying all files and subdirectories from one directory to another.. (GNU tar -C)
by Aristotle (Chancellor) on Jun 17, 2003 at 09:22 UTC |