Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Archive > Archives of Old Posts > General Mac Discussion

 
 
Thread Tools Search this Thread Display Modes
Old Aug 11, 2004, 02:39 PM   #1
BakedBeans
Banned
 
BakedBeans's Avatar
 
Join Date: May 2004
Location: What's Your Favorite Posish
renaming question

on windows you can rename a bunch of files the same thing and then it instantly numbers them like this :

dsf100303020
dsf100303021
ect ect

renamed to

als pics
als pics 1
als pics 2
als pics 3
als pics 4
ect ect

how do you do this in mac osx???



it saves me renaming a million pics

thanks in advance
BakedBeans is offline   0
Old Aug 11, 2004, 02:42 PM   #2
jeremy.king
macrumors 603
 
jeremy.king's Avatar
 
Join Date: Jul 2002
Location: Fox Lake, IL
Curious how you do that in windows, as that would save me some time.

To do on the mac, I know you could write a shell script.
jeremy.king is offline   0
Old Aug 11, 2004, 02:49 PM   #3
emw
macrumors 603
 
emw's Avatar
 
Join Date: Aug 2004
Several are mentioned in this thread.

Check 'em out.
emw is offline   0
Old Aug 11, 2004, 03:03 PM   #4
BakedBeans
Thread Starter
Banned
 
BakedBeans's Avatar
 
Join Date: May 2004
Location: What's Your Favorite Posish
Quote:
Originally Posted by kingjr3
Curious how you do that in windows, as that would save me some time.

To do on the mac, I know you could write a shell script.
just highlight all the files from the bottom up, then right click on the top file and rename als pics(eg) and it will name them all als pics then the number... big up for windows on this one... why not in mac osx...its the first case

score
windows 1 mac 1293994939
BakedBeans is offline   0
Old Aug 12, 2004, 05:50 AM   #5
BakedBeans
Thread Starter
Banned
 
BakedBeans's Avatar
 
Join Date: May 2004
Location: What's Your Favorite Posish
still having troubles with this guys.... i cant seem to use those suggested remedies... any others..
BakedBeans is offline   0
Old Aug 12, 2004, 06:20 AM   #6
kettle
macrumors 65816
 
kettle's Avatar
 
Join Date: May 2002
Location: England, Great Britain (Airstrip One)
Send a message via AIM to kettle
Thumbs up Easy way

If you are renaming graphic files try Graphic Converter it'll bulk rename anything as well as graphic files.
__________________
Well gentlemen, a great deal of money has been invested in this project...
...and we can't allow it to fail.
File Under - METAL
kettle is offline   0
Old Aug 12, 2004, 07:01 AM   #7
HexMonkey
Administrator
 
HexMonkey's Avatar
 
Join Date: Feb 2004
Location: New Zealand
I wrote a script in AppleScript that will do it (although quite slowly), based loosely on some Apple sample code. It's not very advanced and could use a lot of improvements, but you can set it up as follows if you don't like the other solutions. Be warned that the order it renames them in isn't always in alphabetical order, although I think it usually is if you're in list or column view (I'm not sure on the specifics, the script just gets the information from Finder), so if order is important, the script may not be very useful.

Firstly, copy and paste the following code into Script Editor (located at /Applications/AppleScript/Script Editor)
Code:
property nameString : ""
property extension : ""

tell application "Finder" to set theFiles to selection

if number of items in theFiles is greater than 0 then
	display dialog "Please enter the new name for the files:" default answer nameString
	set nameString to text returned of the result
	display dialog "Enter a file extension, or leave blank for none:" default answer extension
	set extension to text returned of the result
	if the nameString is not "" then
		repeat with i from 1 to number of items in theFiles
			set thisItem to item i of theFiles as alias
			set thisInfo to info for thisItem
			set currentName to name of thisInfo
			if extension is "" then
				set extensionString to ""
			else
				set extensionString to "." & extension
			end if
			if i is 1 then
				set newName to nameString & extensionString
			else
				set newName to nameString & " " & (i as string) & extensionString
			end if
			my setItemName(thisItem, newName)
		end repeat
	end if
else
	display dialog "No items are selected" buttons "OK" default button 1
end if

on setItemName(thisItem, newName)
	tell application "Finder"
		set parentFolder to (container of thisItem) as text
		if not (exists item (parentFolder & newName)) then
			try
				set name of thisItem to newName
			on error errorMessage number errorNumber
				tell me to display dialog ("An error occured when renaming to" & newName & ". The file will not be renamed.") buttons "OK" default button 1
				return 0
			end try
		else --the name already exists
			tell me to display dialog ("A file named" & newName & " already exists. The file will not be renamed.") buttons "OK" default button 1
			return 0
		end if
	end tell
end setItemName
At this stage, you need to decide whether to have the script activated from the Script menu or from the Dock. If from the Dock, follow these steps:

1. Save the script as an application, with none of the options checked
2. Drag the application to the Dock
3. Select the files you want renamed and click on the application's icon in the Dock
4. Enter the new name and extension of the files and watch them be renamed

If you're wondering why it's necessary to put it in the Dock, it's because if you opened it from Finder, it would take the focus away from the selected files and rename the application instead.

If you want to run the script from the Script menu, follow these steps:

1. Save the script as a script, again with none of the options checked. Save it somewhere in ~/Library/Scripts so that you can run it from the Script menu.
2. Now you need to make sure that the Script menu is available. If it's not (most likely), just open /Applications/AppleScript/Install Script Menu (open Remove Script Menu later if you like, or command-drag the menu of the menubar to remove it)
3. Select the files in Finder, and run the script from the Script menu
4. Enter the new name and extension

Hope it helps
HexMonkey is offline   0
Old Aug 13, 2004, 12:23 AM   #8
Doctor Q
Administrator
 
Doctor Q's Avatar
 
Join Date: Sep 2002
Location: Los Angeles
Thanks mucho, HexMonkey. I don't need that particular script, but your instructions are wonderfully detailed and helpful. You even mention how to uninstall!
__________________
Oh do pay attention 007. In the wrong hands, this 12-core Mac Pro with three 4K displays, FirePro graphics, and Thunderbolt 2 could be very dangerous.
Doctor Q is offline   0


 
MacRumors Forums > Archive > Archives of Old Posts > General Mac Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
renaming my mac telecaster429 OS X Mavericks (10.9) 3 Mar 29, 2014 07:00 AM
Resolved: Renaming files Peter vd Vorst Mac Basics and Help 3 Sep 9, 2013 11:14 AM
Renaming A Movie eethomson iMac 3 Jan 16, 2013 05:25 PM
Files are not renaming vbmike73 Mac Applications and Mac App Store 3 Jan 11, 2013 09:03 PM
iPhone: Renaming apps fizz7283 Jailbreaks and iOS Hacks 5 Aug 15, 2012 04:04 PM

Forum Jump

All times are GMT -5. The time now is 04:54 AM.

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

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