1 |
Such a question shows the power of bash programming. |
2 |
Method1 : |
3 |
|
4 |
ls -1 *.jpg | while read file; do mv "$file" \ |
5 |
"donald_$file"; done |
6 |
|
7 |
Method2 : |
8 |
ls -1 *.jpg | awk '{ print "mv "$1" donald_"$1; } | \ |
9 |
/bin/bash |
10 |
|
11 |
Method3 : |
12 |
find -name "*.jpg" -exec mv {} donald_{} ';' |
13 |
|
14 |
On Fri, 30 Dec 2005 11:57 am, Jerry McBride wrote: |
15 |
> On Thursday 29 December 2005 08:24, Marco Calviani wrote: |
16 |
> > Hi list, |
17 |
> > maybe this question is a little bit related since it regards non |
18 |
> > Gentoo-specific topics. |
19 |
> > I would like to add a specific suffix to a list of files. For |
20 |
> > example i have files of the type: |
21 |
> > |
22 |
> > duck1.jpg |
23 |
> > duck2.jpg |
24 |
> > duck3.jpg |
25 |
> > |
26 |
> > and i would like them to become: |
27 |
> > |
28 |
> > donald_duck1.jpg |
29 |
> > donald_duck2.jpg |
30 |
> > donald_duck3.jpg |
31 |
> > |
32 |
> > Does somebody knows a simple way to do this via shell? |
33 |
> |
34 |
> Did anyone mention RENAME??? |
35 |
> |
36 |
> A simple "rename duck donald_duck duck*.jpg" would work well also.... |
37 |
> |
38 |
> Cheers. |
39 |
-- |
40 |
gentoo-user@g.o mailing list |