On Tuesday 07 March 2006 10:18, James Hatridge wrote:
Hi all...
I need to compare two dir and delete files in the second dir that have the same name as in the first. How could I do this?
Try: cd <<directory containing files you might delete>> for i in * do if [ -f <<path to other directory>>/${i} ] then rm $i fi done Try this first without the actual "rm" statement, replace it with something like "echo ${i} should be deleted" That way you can tell what it would do and whether you like the results. Cheers, Simon "You can tell whether a man is clever by his answers. You can tell whether a man is wise by his questions." Naguib Mahfouz __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com