Thanks MJ I'll give it a try this weekend.
Stu -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MJ Ray Sent: 10 November 2006 10:08 To: [email protected] Subject: Re: [Peterboro] File Sorting "Stuart Bird" <[EMAIL PROTECTED]> > Is there a command line tool/script that I can create which will recursively > trawl the folders, pick out the latest versions of duplicated files and then > copy those files to a new folder. #!/bin/sh for source in folder1 folder2 folder3 folder4 ; do cd $source && find . -print0 | cpio -p0mv --make-directories target done exit If you literally just want the latest versions, I think this will do it. You probably want to run it with: script -c picklatest.sh picklatest.log as it will make a lot of output as it refuses to copy newer files over old ones. The cd changes to the directory The find generates a null-terminated (so spaces will be OK) list of files in that current directory. The cpio copies the list of null-terminated files, preserving modification time, to the target directory, calling mkdir as needed. The for ... do ... done does it for each folder. If you want to merge the edits, you'll need to do something smarter, maybe involving emacs's ediff, vimdiff, sdiff, tkdiff or similar. Now what makes you think that some of my customers edit files without checking the updated ones into the revision control system? ;-) Hope that helps, -- MJ Ray - see/vidu http://mjr.towers.org.uk/email.html Somerset, England. Work/Laborejo: http://www.ttllp.co.uk/ IRC/Jabber/SIP: on request/peteble _______________________________________________ Peterboro mailing list [email protected] https://mailman.lug.org.uk/mailman/listinfo/peterboro -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.0/524 - Release Date: 08/11/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.0/524 - Release Date: 08/11/2006 _______________________________________________ Peterboro mailing list [email protected] https://mailman.lug.org.uk/mailman/listinfo/peterboro
