Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
> renaming files
post Dec 8 2008, 07:42 PM
Post #1

Whats this Lie-nix Thing?

Group: Members
Posts: 2
Joined: 12-September 08
Member No.: 13,661

I had a bunch of files with filenames like DSCNnnnn.JPG where nnnn was a number between 3211 to 3271. I tried to change the name so the (caps) JPG would be lowercase jpg. I used
mv DSCN*.JPG DSCN*.jpg
and got an error message,
mv: target `DSCN*.jpg' is not a directory. I can do
mv DSCN3211.JPG DSCN3211.jpg
and that works ok. But I can't get the whole batch done with just one command. What am I doing wrong? How do I work around?
Thanks in advance.
Go to the top of the page
+Quote Post
Start new topic
post Dec 8 2008, 10:15 PM
Post #2

Its GNU/

Group: Support Specialist
Posts: 1,806
Joined: 23-January 03
Member No.: 360

Assuming you do not have lots of files (meaning many hundreds) here is a quick bash script.

for file in *.JPG; do
mv "${file}" "${file%JPG}jpg"
Go to the top of the page
+Quote Post

Posts in this topic

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 19th March 2018 - 08:55 PM