[PLUG] Shell command question
Paul Heinlein
heinlein at attbi.com
Mon Jun 10 14:22:53 UTC 2002
On Mon, 10 Jun 2002, guy1656 wrote:
> I have a bunch of files in directory 'A' and copies of MOST of these
> files in directory 'B.'
>
> What is a command which would remove files in 'A' with the same
> names as the ones which appear in 'B' (so I am only deleting the
> extra copies?)
>
> The files which are to remain in 'A' are all ones which do not
> appear in 'B.'
cd /path/to/B
for f in *
do
rm -f "/path/to/A/$f"
done
or
cd /path/to/A
for f in *
do
[ -f "/path/to/B/$f" ] && rm -f $f
done
--Paul Heinlein <heinlein at attbi.com>
More information about the PLUG
mailing list