"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
