[X-Unix] shell scripting

Stroller MacMonster at myrealbox.com
Fri Jan 16 02:45:23 PST 2004


On Jan 16, 2004, at 3:34 am, Brian Medley wrote:

> On Fri, Jan 16, 2004 at 04:16:08AM +0100, Joaquin Henriquez Alzola 
> wrote:
>
>> You do this with the find command use the -mtime
>
> ahh..jolly good...forgot the wonderful find options...
>
> so:
>
>     cd $src_dir
>     find . -newer reference_file -print0 | xargs -0 -J % cp % $dst_dir
>     touch reference_file
>
> Should work?

Yes, but that only copies files which are named. I'd work on the basis 
that you want to copy EVERY file in somefolder into backupfolder - so 
that if someone saves a new file to somefolder, that get's backed up, 
too.

I rather like the idea of saving the backup as a tarball - I think 
`tar` should handle things automagically. From `man tar`:

      --update       Append the named files if the on-disk version has a 
modi-
                     fication date more recent than their copy in the 
archive
                     (if any).  Does not work on quarter-inch tapes.

(`tar --update somefolder/* -f backupfolder/BU.tar` will allow the 
shell to wilcard to "named files").

Stroller.



More information about the X-Unix mailing list