![]() |
sponsored links |
|
|
sponsored links
|
|
1
14th September 05:29
External User
Posts: 1
|
Hi,
Is there a command line way to rename all files in a directory that have the extension JPG to the same name but all lower case? (I.e. FILE.JPG becomes file.jpg or FILE.jpg) Thanks, Mark -- gentoo-user@gentoo.org mailing list |
|
|
|
2
14th September 05:29
External User
Posts: 1
|
You could do a find on JPG and replace with jpg
Patrick Op 25-sep-04 om 18:45 heeft Mark Knecht het volgende geschreven: -- gentoo-user@gentoo.org mailing list |
|
|
3
14th September 05:29
External User
Posts: 1
|
If you're using bash, then setting up a for loop as:
for a in *.JPG; do mv `basename $a JPG`jpg; done will do the job. Note the backticks (not apostrophes) around "basename $a JPG", and the lack of space after it. The backticked command gets replaced with its output. If you preface the mv command with echo (do echo mv ...), you'll see a list of the commands that will run (but they won't BE run - so you can check you got the syntax right). This will only change the extension, not the rest of the filename. Alex x x -- Website: http://www.penwing.org.uk Jabber: penwing@jabber.org (go look at http://www.jabber.org) ICQ: 92075277 (if you must) Linux User: 360012 -- gentoo-user@gentoo.org mailing list |
|
|
6
14th September 05:30
External User
Posts: 1
|
im not saying try this but was wondering what would mv *.JPG *.jpg do?
-- gentoo-user@gentoo.org mailing list |
|
|
8
14th September 05:30
External User
Posts: 1
|
Hello Mark,
Lowering the case of the extension works as follows (piece of shell script): for i in *.JPG do mv $i `basename $i .JPG`.jpg done Regards, Joost -- gentoo-user@gentoo.org mailing list |
|
|
9
14th September 05:31
External User
Posts: 1
|
emerge mmv
mmv: move/copy/append/link multiple files by wildcard patterns. Andres -- --- When we are young Wandering the face of the Earth Wondering what our dreams might be worth Learning that we're only immortal For a limited time Neil Peart - Dreamline -- gentoo-user@gentoo.org mailing list |
|
|
10
14th September 05:31
External User
Posts: 1
|
Yes, there are dozens of command lines. They'll probably all
incorporate a loop and a tool to translate uppercase to lowercase. Here's my take for bash shell: for JPG in *.JPG; do # FILE.JPG -> file.jpg # mv "$JPG" "$(echo $JPG | tr '[:upper:]' '[:lower:]')" # FILE.JPG -> FILE.JPG.jpg # mv "$JPG" "$JPG".jpg # FILE.JPG -> FILE.jpg # mv "$JPG" "${JPG%.*}".jpg done Alexander Skwar -- "It ain't so much the things we don't know that get us in trouble. It's the things we know that ain't so." -- Artemus Ward aka Charles Farrar Brown ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -- gentoo-user@gentoo.org mailing list |
|