Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Quick script request
Date: Wed, 25 Jun 2008 15:37:38
Message-Id: 49bf44f10806250837ybbc068ar1f47d23cd7e7df80@mail.gmail.com
In Reply to: Re: [gentoo-user] Quick script request by Alan McKinnon
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

Replies

Subject Author
Re: [gentoo-user] Quick script request Alex Schuster <wonko@×××××××××.org>
Re: [gentoo-user] Quick script request Alan McKinnon <alan.mckinnon@×××××.com>