Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

whocares

macrumors 65816
Original poster
Oct 9, 2002
1,494
0
:noitаɔo˩
I've got a whole bunch of photos in various subfolders. Some of these photos have the same relative name (ie same file name but in different folders).

I would like to rename all these files like 000001.ext, 000002.ext etc, independently of file location so I can copy all the files back to one single folder (I can handle that bit in Terminal). There are many sub-folders so I need something recursive.

I've tried Renamer4Mac, but it isn't recursive. Does anyone know of a different app that would work, or even a terminal command/script/binary that would do the trick?

Cheers,
D
 

johnnyjibbs

macrumors 68030
Sep 18, 2003
2,964
122
London, UK
It sounds like an Applescript would do the trick nicely, but unfortunately I'm not familiar with it. Hopefully someone will be able to post a nice little Applescript for this function.
 

dukemeiser

macrumors 6502a
Dec 17, 2002
529
0
Iowa
Applications -> AppleScript -> Example Scripts -> Finder Scripts should have some AppleScripts you're looking for.
 

Nuc

macrumors 6502a
Jan 20, 2003
798
6
TN
This is a good program!

live4ever said:
I like A Better Finder Rename, check it out as well (on Versiontracker).

I second this..great app.
 

tjwett

macrumors 68000
May 6, 2002
1,880
0
Brooklyn, NYC
here's another just incase:

http://www.versiontracker.com/dyn/moreinfo/macosx/21458

check out http://www.macscripter.net for all your AppleScript needs.

and here is a very basic script that may do what you want, or you can modify it if you like:

set items_per_subfolder to 100
set subfolder_prefix to "subfolder "

tell application "Finder"
activate
set the_folder to (choose folder) as alias
set {i, j, the_contents} to {1, 1, (items of the_folder)}
set new_folder to make new folder at the_folder with properties {name:(subfolder_prefix & (j as string))}
repeat with this_item in the_contents
if i > items_per_subfolder then
set {i, j} to {1, (j + 1)}
set new_folder to make new folder at the_folder with properties {name:(subfolder_prefix & (j as string))}
end if
move this_item to new_folder
set i to i + 1
end repeat
beep
display dialog (((count of the_contents) as string) & " items split into " & (j as string) & " subfolders.") buttons {"OK"} default button 1 with icon 1 giving up after 10
end tell
 

tjwett

macrumors 68000
May 6, 2002
1,880
0
Brooklyn, NYC
MrMacman said:
tjwett -- you have to use the the 'php' feature... your applescrip was messed up by the smily face.

eep :eek: thanks for the heads up. yeah, ummm....i don't think the smilies will add much functionality to the script. sooorry.

EDIT* and now i can't even figure out how to fix it. humbling indeed. :rolleyes: bahh, just ferget it. im gunna go git destraktid bye sum shynee objeks.
 

johny5

macrumors 6502a
Mar 31, 2007
751
11
UK
Absolutely PERFECT solution. This is the FIRST AppleScript I've run on my new Mac. No 3rd party apps necessary.

Excellent!! ;)

Agreed, I have been trying to create advanced rules for ages using automator but just had a quick browse through some sample scripts and realise scripts are pretty powerful!

I dont want to hijack the thread, but is there a book or somewhere to learn about scripts?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.