[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: BASH file processing help



this writes exactly as you say it

cd /where/to/keep
for file in $(ls -1)
do
	[ -f /where/to/delete/$file ] && rm /where/to/delete/$file
done

this only works at one level (it doesn't process sub-directories)

btw find as a -printf option with which you can format the output as
desired (for example keeping only the name of the file, not its path). rtfm
"man find"

hth


A 15:33 17/11/2003 -0600, vous avez écrit :
>I have been trying to complete a simple (for me on the WinBlows platform)
file 
>operation and seem unable to do so.  Basically I need something along the
lines 
>of "For all files in a given directory, delete files with the same name from 
>this other directory".  I tried using find with exec but that causes me
grief 
>because it adds the current path to the file name to be deleted.  I tried
using 
>a for look but cannot seem to get it to work from the command line, without 
>putting it in a script file.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]