LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   rename file with a pattern (https://www.linuxquestions.org/questions/programming-9/rename-file-with-a-pattern-267091/)

sujith_deva 12-16-2004 11:55 AM

rename file with a pattern
 
Hi

i have a lot of file named like xxxx.doc.pdf i want to rename all the file in to xxxx.pdf

i hope a script will help me to do the job all the files contain in a directory

Thanks in advance

Sujith.V.S

Hko 12-16-2004 12:09 PM

Install the "mmv" (Multiple Move) package, and read its man page.

druuna 12-16-2004 12:13 PM

Must admit that mmv is probably the best way, if you want to 'write your own':

for THIS in *doc.pdf
do
echo ${THIS} ${THIS%%.doc.pdf}.pdf
done

replace echo with mv, cp whatever.

Berto 12-16-2004 01:19 PM

Hey, I've been wondering about this too, but where do you find mmv? All I can find on google are links to the Debian site.

Tinkster 12-16-2004 01:51 PM

http://www.google.co.nz/linux?hl=en&...a=lr%3Dlang_en

Odd ... no mention of Debilian in the first 10 hits ...



Cheers,
Tink

Hko 12-16-2004 02:01 PM

See also this:
http://wiki.linuxquestions.org/wiki/Mmv

Berto 12-16-2004 07:33 PM

"Odd ... no mention of Debilian in the first 10 hits ..."

Yeah, but that's the New Zealand google, check out US google: http://www.google.com/search?q=mmv&s...en-US:official


EDIT: Dammit, forgot about Linux google...

Tinkster 12-16-2004 07:39 PM

Quote:

Originally posted by Berto
"Odd ... no mention of Debilian in the first 10 hits ..."

Yeah, but that's the New Zealand google, check out US google: http://www.google.com/search?q=mmv&s...en-US:official


EDIT: Dammit, forgot about Linux google...

http://www.google.com/linux?hl=en&lr...=Google+Search

Just to please you ... and still no mention of debilian.


Cheers,
Tink


All times are GMT -5. The time now is 08:56 PM.