1 |
>> Feel free to ignore me here, but if anyone could whip out a quick |
2 |
>> script for this I would really appreciate it. |
3 |
>> |
4 |
>> I need to move any files from dir1 to dir2 if they don't already |
5 |
>> exist in dir2 with a slightly different filename. The dir1 files are |
6 |
>> named like a-1.jpg and the dir2 files are named like |
7 |
>> a-1_original.jpg. |
8 |
>> |
9 |
>> - Grant |
10 |
> |
11 |
> rough and ready, off the top of my head: |
12 |
> |
13 |
> cd dir1 |
14 |
> for i in *jpg |
15 |
> do |
16 |
> j = basename $i .jpg |
17 |
> cp -u ${j}.jpg dir2/${j}_original.jpg |
18 |
> done |
19 |
> |
20 |
> 'cp -u' works around the messy problem of checking if the destination |
21 |
> file exists |
22 |
|
23 |
Thanks guys, can you tell me how to execute this? Put it in a file |
24 |
and './file' I think? Should I have special stuff at the top of the |
25 |
file? |
26 |
|
27 |
- Grant |
28 |
-- |
29 |
gentoo-user@l.g.o mailing list |