On Wednesday 25 June 2008, Grant wrote:
> Feel free to ignore me here, but if anyone could whip out a quick
> script for this I would really appreciate it.
>
> I need to move any files from dir1 to dir2 if they don't already
> exist in dir2 with a slightly different filename.  The dir1 files are
> named like a-1.jpg and the dir2 files are named like
> a-1_original.jpg.
>
> - Grant

rough and ready, off the top of my head:

cd dir1
for i in *jpg
do
  j = basename $i .jpg
  cp -u ${j}.jpg dir2/${j}_original.jpg
done

'cp -u' works around the messy problem of checking if the destination 
file exists

-- 
Alan McKinnon
alan dot mckinnon at gmail dot com

-- 
gentoo-user@lists.gentoo.org mailing list

Reply via email to