Ian Douglas wrote:
>
> Can anyone help me out with a script (sh or Perl, doesn't matter) that will
> recursively go through any directories I specify on the command line to move
> old files to a new directory while retaining the original directory path?
>
> ie:
>
> /home/oldfile1
> /home/olddir/oldfile2
> /home/olddir/oldfile3
>
> running the script as "script /home" will move the files to /archive so it
> looks like this:
>
> /archive/oldfile1
> /archive/olddir/oldfile2
> /archive/olddir/oldfile3
>
> I don't mind tweaking the script to force a date to compare against (say, to
> move any files older than September 30, 1999) or the destination location.
If you just want to copy the files _unconditionally_, then:
cd /home ; cp -a * /archive
will do the job nicely.
If you only want to copy _newer_ files (please note that the result
in /archive would be exactly the same as above unless you had restored
older files in your source tree, only the _time_ and I/O needed would
be
greater) then it's easiest to do it with tar and piping:
tar cvf - /home | (cd /archive; tar xvf -)
but you should then use the correct options in tar to put only
the needed files in your archive (see tar --help for options).
--
Jean-Louis Debert [EMAIL PROTECTED]
74 Annemasse France
old Linux fan