>> >> 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 >> >> Thanks guys, can you tell me how to execute this? Put it in a file > > yes > >> and './file' I think? > > Either that or chmod a+x file and execute it directly > >> Should I have special stuff at the top of the >> file? > > #!/bin/bash
I put the above script in a file, added the appropriate header, issued chmod, and when I execute with ./file I get a bunch of these: ./script: line 6: j: command not found cp: cannot stat `.jpg': No such file or directory - Grant -- gentoo-user@lists.gentoo.org mailing list