LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-26-2004, 12:26 AM   #1
joe_stevensen
LQ Newbie
 
Registered: Jun 2001
Location: San Jose, CA
Distribution: Debian (Servers); Gentoo (Desktop)
Posts: 29

Rep: Reputation: 15
Need help with renaming jpgs


I have a bunch of JPGs in my personal photo gallery. I want to clean everything up and move all the pics to one folder so that I can look through them.

I would just do a mv *.jpg, but a LOT of files have the name (001.jpg, 002..jpg)...etc in each subdir)

Any idea how I can recursively move and rename all JPGs from subdirs to a toplevel dir?

001.jpg
002.jpg

is fine..
Perl or shell is ok.

thanks!
 
Old 06-26-2004, 01:42 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Wouldn't the easiest way be to use a GUI file explorer ("Konqueror", for example)?

Just:
1. Go to the top-level directory you want to search down from
2. Search for *.jpg
3. Highlight everything it finds, and
4. Drag and drop into the new folder

With "find", you could do something like:

find SRCDIR -name "*.jpg" -exec mv {} NEWDIR \;
<= EXPERIMENT WITH THE SYNTAX TO MAKE SURE
EVERYTHING WORKS BEFORE YOU ACTUALLY DO THE REAL "MV"...
 
Old 06-26-2004, 04:29 AM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
GNU mv supports options to not overwrite the file if it exists, do man mv and see particulary -b, -S, -V options
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and Kodak jpgs Tomasfuego Programming 1 05-03-2005 08:29 PM
pdf files to jpgs linuxhippy Slackware 3 04-04-2005 07:33 PM
Merge JPGs mddolloff Linux - Software 5 11-21-2004 07:41 AM
animating jpgs to mpg? sk8guitar Linux - General 2 07-15-2004 07:16 PM
Mozilla 1.4 and jpgs. f0rmula Linux - Software 0 12-12-2003 10:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration