Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 12, 2008, 08:06 AM   #1
Darice Terry
macrumors newbie
 
Join Date: Feb 2008
how to rename multiple files on the Mac

I am in an online class and need to send a folder with 10 files to the teacher. The pc uses can use F2 and it will rename all the files with the one name of the folder. Does anyone know how to do this on the Mac Ibook?
Darice Terry is offline   0 Reply With Quote
Old Feb 12, 2008, 08:36 AM   #2
satyam90
macrumors regular
 
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
if u are talking about windows "F2" for renaming, the same way u can accomplish the task on Mac is to right click (or ctrl+click) and select "Get Info" from the popup. In that u can rename the folder name.

2nd method:
Use "terminal" or "console" and go to that place of folder. use "mv (actual_name) (final_name)"

Has my answer solved ur problem?
satyam90 is offline   0 Reply With Quote
Old Feb 12, 2008, 08:38 AM   #3
JNB
macrumors 604
 
JNB's Avatar
 
Join Date: Oct 2004
Location: In a Hell predominately of my own making
Send a message via Skype™ to JNB
Automator should do the trick for batch changes like that.
__________________

JNB is offline   0 Reply With Quote
Old Feb 20, 2008, 12:34 PM   #4
krye
macrumors 68000
 
krye's Avatar
 
Join Date: Aug 2007
Location: USA
google "renamer4mac"
krye is offline   0 Reply With Quote
Old Jun 16, 2008, 10:55 AM   #5
ChrisA
macrumors G4
 
Join Date: Jan 2006
Location: Redondo Beach, California
Quote:
Originally Posted by Darice Terry View Post
I am in an online class and need to send a folder with 10 files to the teacher. The pc uses can use F2 and it will rename all the files with the one name of the folder. Does anyone know how to do this on the Mac Ibook?
What exactly do you need to do. Yopu say "rename all the files with the one name of the folder" but I'm sure yo don't want want all the files to have the same name. You want each file to have a differnt name right?

It's trivral in the terminal to change file names. The command of "mv" (just two leters) if you want to apply the mv command to multiple files then you might use mv in conjucion with "find" where you tell find which files need to be mv'd.
ChrisA is offline   0 Reply With Quote
Old Dec 2, 2009, 11:37 PM   #6
ThierryL
macrumors newbie
 
Join Date: Dec 2009
TotalCommander or Terminal

The question is wrong; if you press F2 on a PC when selecting 10 files, the last filename of the selection will open, and there is no way you can automatically retrieve the name of the folder to add as a prefix or suffix to all 10 files.

You can quickly do this using terminal as suggested by a previous post, but I would add that you can do multiple entries at the same time. Using TextWrangler (free) column mode, it's easy to create a bash shell script this way. As you may know, the terminal allows easy copy-paste on a Mac.

If you're not script-oriented, you can use DiskOrder3 or TotalCommander. You can use TotalCommander on your Mac if you have VMware Fusion 3 in "unity" mode. So you run it as any Mac app.

Hope this helps
ThierryL is offline   0 Reply With Quote
Old Dec 3, 2009, 09:13 AM   #7
spice weasel
macrumors 65816
 
Join Date: Jul 2003
Quote:
Originally Posted by JNB View Post
Automator should do the trick for batch changes like that.
+1. Automator is very easy to use, and will let you do batch changes to filenames. Look for the right workflow (should be something like "Rename finder items") under the "Finder" column in Automator. I'm not in front of my Mac right now, but it should be clear and easy to find.

Drag the items you want to rename into the workflow pane in Automator. Then drag the Rename workflow script under that. Enter the filename you want to use and select the options (serial naming, etc.) Start the workflow and it will be done in a heartbeat.
spice weasel is offline   0 Reply With Quote
Old Jan 11, 2010, 02:16 PM   #8
Big Dave
macrumors 6502
 
Join Date: Nov 2007
Location: Crestview, Fl
You can also use the terminal to rename files.

This is just a quick example of one use and hopefully with google or macrumors forums you can tailor it to your use.
Let's say you have 5 files.
file1
file2
file3
file4
file5
You want to add the .txt extension to the file.
Open an editor and enter the following in a file named script:
#!/bin/bash
for i in file*
do
mv $i $i.txt #The mv command means move. Use cp to copy.
done

Then make the script executable.
$chmod +x script
Then launch it
./script
Big Dave is offline   0 Reply With Quote
Old Jun 26, 2010, 03:39 AM   #9
peterhorner
macrumors newbie
 
Join Date: Jun 2010
This YouTube video explains it all :)

This video shows you how to batch rename using Automator
http://www.youtube.com/watch?v=Y6eLxNxzgqQ
peterhorner is offline   1 Reply With Quote
Old Jun 26, 2010, 09:45 AM   #10
miles01110
macrumors 604
 
miles01110's Avatar
 
Join Date: Jul 2006
Location: The Ivory Tower (I'm not coming down)
Renaming utilities: (google them)

Name Mangler
NameChanger
Renamer4Mac
Automator (not as good as the others)
__________________
Got a problem? Check here first.
miles01110 is offline   0 Reply With Quote
Old Jun 4, 2011, 08:59 AM   #11
bwana
macrumors newbie
 
Join Date: Sep 2001
liked the script.
tried to modify it to remove the .txt extension of ALL files in a directory and make copies
these files are named 1.txt , 2.txt , etc


like so


#!/bin/bash
for i in *
do
cp $i.txt $i #The mv command means move. Use cp to copy.
done


got a LOT of errors for example

cp: 990.txt.txt: No such file or directory


help?
bwana is offline   0 Reply With Quote
Old Jun 4, 2011, 09:10 AM   #12
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Quote:
Originally Posted by bwana View Post
liked the script.
tried to modify it to remove the .txt extension of ALL files in a directory and make copies
these files are named 1.txt , 2.txt , etc


like so


#!/bin/bash
for i in *
do
cp $i.txt $i #The mv command means move. Use cp to copy.
done


got a LOT of errors for example

cp: 990.txt.txt: No such file or directory


help?
In this case $i with have the .txt on the end of it already. $i expands to 990.txt and so $i.txt expands to 990.txt.txt.

You need to remove the trailing .txt from $i. The ${var%suffix} syntax will expand by removing suffix from variable var.

Try using this cp command in your script.
Code:
cp $i ${i%.txt}
jiminaus is offline   0 Reply With Quote
Old Jun 4, 2011, 02:26 PM   #13
sero
macrumors member
 
Join Date: Aug 2008
The best way to batch rename, IMO, is to drop the attached perl script in your bin and use regex. E.g.
PHP Code:
rename s/foo/bar/ *.txt 
Attached Files
File Type: zip rename.zip (1.6 KB, 530 views)
sero is offline   0 Reply With Quote
Old Jun 4, 2011, 05:26 PM   #14
bwana
macrumors newbie
 
Join Date: Sep 2001
tnx jiminaus and sero.
preciate ur help
bwana is offline   0 Reply With Quote
Old Aug 3, 2011, 12:03 AM   #15
mikeschmeee
macrumors 6502a
 
Join Date: Mar 2009
Quote:
Originally Posted by miles01110 View Post
Renaming utilities: (google them)

Name Mangler
NameChanger
Renamer4Mac
Automator (not as good as the others)
I know this is an old thread but thanks for this! I downloaded NameChanger and it worked! So fast. It renamed over just under 11,000 photos from my GoPro within a few seconds. Didn't make duplicates either just simple renamed.

Thanks again!
__________________
13" Aluminum MacBook, 2.0GHz, 4GB RAM, 160GB HD ; iPhone 3GS 8GB
YouTube
flickr
Portfolio
mikeschmeee is offline   0 Reply With Quote
Old Dec 9, 2011, 03:36 AM   #16
sm789
macrumors newbie
 
Join Date: Dec 2011
My problem!!!

I am new here so I don't know if I am supposed to start a new post..

My problem is as follows - My technical department generates an excel report every other day. Their system is automated so the file name is very long and goes like this Multiproduct Technical Report for 2011 12 06 by Jones.xls. I have hundreds of reports like this. Is there a way where I can change the names of all the files to say MTP 2011 xx xx.xls? Basically I want to preserve the unique date, remove "by XYZ" and modify (shorten) the "Multiproduct Technical Report" to something like "MTP"?

Thank you for your help.

sm
sm789 is offline   0 Reply With Quote
Old Dec 9, 2011, 07:37 AM   #17
LateOne
macrumors newbie
 
Join Date: Mar 2010
Location: S . Yorks
I just thought I'd mention the (perhaps) obvious, that simple file renaming is available by putting Applescript in the menu bar via the Applescript Editor ( Utilities) preferences.

Then, having selected your files to rename, select it in the menubar, choose Finder Scripts and there are options to Add (to) and Trim (from) file names.

Not hugely sophisticated but it's done the job for me in the past.

It nearly does the job that sm789 wants to do ( assuming multiple passes ) but I suspect there's an issue with the 'by Jones' bit because it won't always be Jones.
LateOne is offline   0 Reply With Quote
Old Dec 9, 2011, 08:56 AM   #18
subsonix
macrumors 68030
 
Join Date: Feb 2008
Quote:
Originally Posted by sm789 View Post
Is there a way where I can change the names of all the files to say MTP 2011 xx xx.xls? Basically I want to preserve the unique date, remove "by XYZ" and modify (shorten) the "Multiproduct Technical Report" to something like "MTP"?

Thank you for your help.

sm
If I understood this correctly, the only thing that needs to be preserved is the date, and make sure that the file name matches the form exactly so that no other files accidentally are renamed. In this case:

"Multiproduct Technical Report for ${date} by ${name}.xls"

Here's one approach with bash.

Code:
#!/bin/bash
#
# Check for arguments

if [ $# -ne 1 ]
then
    echo "Arguments: <file to be renamed>"
    exit 1
fi

# Make sure that the file name is of the form: ""Multiproduct Technical Report for ${date} by ${name}.xls"
test=$(echo "$1" | grep -P "^Multiproduct Technical Report for \d{4}\s\d{2}\s\d{2} by \w+\.xls$")

if [ -n "$test" ]
then
    date=$(echo "$1" | cut -d" " -f5-7)
    echo "MTP ${date}.xls"
    #mv "$1" "MTP ${date}.xls"
fi
This just echoes the new name to the terminal to confirm that it works as intended. To rename the file you would have to move the # symbol from the red line to the green. Use at your own risk etc.
subsonix is offline   0 Reply With Quote
Old May 27, 2012, 08:44 AM   #19
MattiasN
macrumors newbie
 
Join Date: Nov 2009
Location: Gothenburg, Sweden
Interesting thread! Do you know how to rename files in multiple folders recursively where the renaming should be an added prefix that has been taken from the folder name?

For example, to set the date as the prefix on each photo file in each date folder in the following folder structure?

2012-01-01 (Folder contains jpg photo files taken on the 1st of Jan 2012)
2012-02-28 (Folder contains jpg photo files taken on the 28th of Feb 2012)
2012-03-15 (Folder contains jpg photo files taken on the 15th of Mar 2012)
...

It would be even more fantastic if it was possible to shorten the inserted date prefix to just "YYMMDD_" instead of insert the original full date and the dashes "YYYY-MM-DD_".

The original file name is "DSCF12345.jpg"
The renamed file name should be: "120101_DSCF12345.jpg"

Last edited by MattiasN; May 27, 2012 at 08:47 AM. Reason: minor text corrections
MattiasN is offline   0 Reply With Quote
Old Mar 3, 2013, 04:27 AM   #20
MacBpro
macrumors member
 
Join Date: Mar 2011
Location: Chicago, IL
Cant believe why apple make it so complicated for some frequently use functions!!!! It sounds like we are going back to the apple 2 age... need to memorize all the commands!!!

Do they have any idea there is a big room for them to improve and make it really USER FRIENDLY!!!????

really makes me sick!!!
MacBpro is offline   0 Reply With Quote
Old Mar 3, 2013, 07:29 AM   #21
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by MacBpro View Post
Cant believe why apple make it so complicated for some frequently use functions!!!! It sounds like we are going back to the apple 2 age... need to memorize all the commands!!!

Do they have any idea there is a big room for them to improve and make it really USER FRIENDLY!!!????

really makes me sick!!!
Frequently used? Seriously? I'm in my 29th year using Macs and have never, ever found any need to do this.
gnasher729 is offline   0 Reply With Quote
Old Mar 4, 2013, 05:34 AM   #22
ghellquist
macrumors regular
 
Join Date: Aug 2011
Location: Stockholm Sweden
And if you start the terminal window, there are lots and lots of variations on how to do the renaming. Lurking in there is a full Unix system, with all of the commands either already installed or easily downloadable.

Learning to use the shell commands or perl or similar programming languages will take a bit of effort but can be very worthwhile.

There are of course graphical programs doing some of these things, but if your exact requirement is not handled you are generally off on your own. Then shell is your friend.

//Gunnar
ghellquist is offline   0 Reply With Quote
Old Mar 19, 2013, 06:05 PM   #23
OlandeseVolante
macrumors newbie
 
Join Date: Feb 2011
Location: Turin, Italy
Hello!

I think I'm having the same problem of Darice Terry, but I'm guessing, since he's never replied again to his own thread.

Just today I was looking for a friendly way to rename multiple files with the same name (different extensions of course!) on Mac OS X Lion, but I haven't found any yet.

Let me explain. With Windows 7, in order to rename two files at once, for example an AVI file with a Subtitles file:

file1.avi
file2.srt

I can select them both, press F2 (or Right click > Rename), and type the new name once. The result will be:

new_name.avi
new_name.srt

With OS X, I have to click on the first file and type the new name, then click on the second file and do the same.

Is there an easier way, not involving scripting? I can't believe that Windows can be more user friendly than OS X

Thanks!

Last edited by OlandeseVolante; Mar 19, 2013 at 06:18 PM.
OlandeseVolante is offline   0 Reply With Quote
Old Mar 20, 2013, 03:40 AM   #24
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by OlandeseVolante View Post
Hello!

I think I'm having the same problem of Darice Terry, but I'm guessing, since he's never replied again to his own thread.

Just today I was looking for a friendly way to rename multiple files with the same name (different extensions of course!) on Mac OS X Lion, but I haven't found any yet.

Let me explain. With Windows 7, in order to rename two files at once, for example an AVI file with a Subtitles file:

file1.avi
file2.srt

I can select them both, press F2 (or Right click > Rename), and type the new name once. The result will be:

new_name.avi
new_name.srt

With OS X, I have to click on the first file and type the new name, then click on the second file and do the same.

Is there an easier way, not involving scripting? I can't believe that Windows can be more user friendly than OS X

Thanks!
You're in the programming section.
Terminal, man mv
gnasher729 is offline   0 Reply With Quote
Old Mar 20, 2013, 06:47 AM   #25
OlandeseVolante
macrumors newbie
 
Join Date: Feb 2011
Location: Turin, Italy
Quote:
Originally Posted by gnasher729 View Post
You're in the programming section.
Terminal, man mv
Sorry I didn't know, I ended up here by searching "how to rename multiple files" with Google

So you confirm that there's no way to do that only with the GUI?

Thanks
Roberto
OlandeseVolante is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Renaming multiple files but not batch rename Cheney5 Mac Applications and Mac App Store 5 Mar 17, 2014 11:49 PM
bulk rename utility for OSX that works with multiple subfolders mrjayviper Mac Applications and Mac App Store 1 Jan 2, 2014 01:11 PM
unzipping multiple files on mac? pe93co Mac Applications and Mac App Store 1 Nov 8, 2012 08:21 PM
Permanently Rename Music Files stacybear23 Mac Basics and Help 3 Oct 18, 2012 01:13 PM
Rename All Files At Once SevengerNC MacBook Pro 9 Jul 16, 2012 06:31 PM

Forum Jump

All times are GMT -5. The time now is 02:21 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC