ComputerForum.com ComputerForum.com  
TigerDirect
 
Go Back   Computer Forum > Computer Software > Operating Systems

Reply
 
LinkBack Thread Tools Display Modes
Old 05-31-2007, 07:46 PM   #1 (permalink)
Gold Member
 
Jonyboy's Avatar
 
Join Date: Dec 2006
Posts: 266
Default Linux - mass rename

Hi all, so i've been using linux for a long time but have only recently stumbled across this kind of task.

If i had a group of images from a camera (and they went like..)

img-001.jpg, img-002.jpg, img-003.jpg, img-004.jpg etc... (up to say 100)

how would i be able to do a mass rename and turn them into

Europe-2007-001.jpg, Europe-2007-002.jpg, Europe-2007-003.jpg etc...

Any programs or command line tools you know of, cause i've googled around to no avail, thanks all!
Jonyboy is offline   Reply With Quote


Old 05-31-2007, 08:38 PM   #2 (permalink)
VIP Member
 
tlarkin's Avatar
 
Join Date: Apr 2006
Location: Kansas City, MO
Posts: 6,056
Default

well a simple shell script may do the trick, I would test this out before doing it though

open up your console (terminal) and from the CLI change into your pic directory

now you can do this as an example

Code:
mv \*.jpeg \newname.jpeg
I also found this shell script that will do it massively

Code:
EXTENSION=.jpg

LOGFILE=./log.filemove

TIMESTAMP=$(date +%G%m%d%H%M)

# Loop through every file in the current directory
# with the appropriate extension and rename it to
# the form SUBJECT[RANDOM NUMBER].[EXTENSION]

for FILE in *"$EXTENSION"; do

NEWNAME="SUBJECT${RANDOM}${EXTENSION}"

# Sanity check to make sure the script doesn't
# overwrite a previously renamed file. This is
# unlikely, but we want to check for it to be
# sure.
#Make sure to modify this part so it uses the right name

while [ -e "$NEWNAME" ]; do
NEWNAME="SUBJECT${RANDOM}${EXTENSION}"
done

# Rename the file to its new randomized form

mv $FILE $NEWNAME

# Log the name change mapping

printf '%s\t%s\n' "$FILE" "$NEWNAME" >> $LOGFILE

# Change the timestamp to match for each file
# and further remove differentiating file
# information (differing timestamps) that might
# lead to subconscious research bias

touch -t $TIMESTAMP $NEWNAME

done
**EDIT

forgot to add this link too, gui based app

http://www.icewalkers.com/Linux/Soft...20460/mvb.html

Last edited by tlarkin; 05-31-2007 at 08:41 PM.
tlarkin is offline   Reply With Quote
Old 05-31-2007, 08:55 PM   #3 (permalink)
Gold Member
 
Jonyboy's Avatar
 
Join Date: Dec 2006
Posts: 266
Default

IT WORKED! I downloaded that program (script) and it's really easy to use. 10/10 thanks man. Dowloaded it and within 5 minutes i had done it. Thanks.
Jonyboy is offline   Reply With Quote
Old 05-31-2007, 10:29 PM   #4 (permalink)
Gold Member
 
Jonyboy's Avatar
 
Join Date: Dec 2006
Posts: 266
Default

I have another "problem" now. I've managed to rename all of my pictures (in multiple folders) but would like to bring all of the images into one folder (with no sub folders).

so i would change

./xyz/1/europe-2007-001.jpg (and the other hundred)

and

./xyz/2/cyprus-2005-001.jpg (and the other hundred)

into

./xyz/europe-2007-001.jpg
./xyz/cyprus-2005-001.jpg

so i could have all my photos in one directory.

-------

I was thinking about going through this by copying and pasting in the GUI (but i have 20 folders to copy from) and although i wouldn't mind doing that i feel there must be an easier way and that i should learn more about Linux, and i wouldn't mind making a shell script but i don't know how to use the cp command and only copy the contents.
Jonyboy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which linux Arm_Pit3 Operating Systems 13 01-20-2008 03:49 PM
why Linux is better than window alohanema Operating Systems 38 11-19-2007 03:33 PM
Linux Program BrandonL Operating Systems 4 11-15-2005 04:00 AM
Linux Questions Rexhasta Operating Systems 9 10-05-2005 10:29 PM
os ??? bloospoon Operating Systems 8 07-22-2004 10:55 PM


All times are GMT +1. The time now is 09:23 AM.


Powered by: vBulletin Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Copyright © 2002-2007 Computer Forum and Web Design Forum