[Tfug] Need help with a complicated command line copy...

Paul Lemmons paul at lemmons.name
Wed Jun 27 15:35:22 MST 2007


-------- Original Message  --------
Subject: [Tfug] Need help with a complicated command line copy...
From: "Jim March" <1.jim.march at gmail.com>
To: "Tucson Free Unix Group" <tfug at tfug.org>
Date: 06/27/2007 03:05 PM
> Guys,
>
> I have a complicated problem.
>
> I have a stack of old hard disks with data a friend wants extracted.
> There are a lot of duplicates, and of course they're scattered across
> multiple subdirectories.
>
> The file types are as you'd expect: .pdf, .doc, .xls, etc.
>
> At the DOS command line I'd have trouble with this: I could use XCOPY
> to move the files (based on extension) from disk to disk including
> subdirectories, but In this case I don't WANT the target-location
> files to be in subdirectories.  Instead, as I pile the files into the
> target location I want to keep them all in one, and as new ones try
> and come in retain the one with the latest datestamp.
>
> I'm using standard Ubuntu Feisty so I figure there has to be a way to
> skin this cat at the command line, probably with standard tools but,
> maybe with some add-in package?  Any tips would be welcome :).
>
> Thanks!
>
> Jim
>
> _______________________________________________
> Tucson Free Unix Group - tfug at tfug.org
> Subscription Options:
> http://www.tfug.org/mailman/listinfo/tfug_tfug.org
>
>   
Hmmmm have not tried this but I think....

# find /source/directory -type f | xargs -i{} rsync -u "{}" "/dest/dir/{}"

The find will locate all fles. You can limit the file types with the 
-name option.
The xargs program will run the command after it on each file that it finds
The rsync command will check dates before copy and not overwrite newer 
files.

It is not tested but I think it is probably pretty close to what you are 
saying you want.

-- 
Sometimes I wonder.  Were our faith able to stand upright and look around, would it be looking down at the mustard seed or standing in awe of the height and bredth of it.





More information about the tfug mailing list