Need script to rename files if duplicates exist upon move

Here’s the command I use in my applescript:

do shell script “hdiutil burn /Users/denns/Desktop/denns.dmg -noverifyburn -noeject -optimizeimage”

When I run this command in applescript my backup program just skips this line. I have put in an on error message but nothing happens. Applescript just blows by this command. I run it thru Terminal and I get an error . I have narrowed the problem down to the option -optimizeimage. When I take it out everything works fine. I’ve had a look at the man pages for hdiutil -optimizeimage and its there and my syntax is right. Although, depending on who you ask, the disk image </Users/denns/Desktop/denns.dmg> should go on the right side (after the options) as opposed to the ‘middle’. Regardless of where it’s located the command still works when <-optimizeimage> is taken out. Any suggesstions as to why this is happening?

Hi,

I have a great script that moves all files from sub folders to the main folder. The only problem is that if the subfolders contain files with identical names I get an error message because the main folder cannot contain 2 files with identical names. Is there a way to alter the script to it arbitrarily rename some file names (but not the extension. The extension must remain the same) of duplicates exist. Alternatively, it could also rename all files with new name before moving them. That way it would not have to check for duplicate names.
Thank you very much for your help in advance.

Ken

set the desktopFolder to path to desktop
tell application “Finder”
set topFolder to folder “Proofs” of pathToDesktop
set subFolders to every folder of topFolder
repeat with aFolder in subFolders
my processFolder(aFolder, topFolder)
end repeat
end tell

on processFolder(thisFolder, topFolder)
tell application “Finder”
move (files of thisFolder whose name extension is in {“jpg”, “crw”}) to topFolder
set subFolders to every folder of thisFolder
repeat with aFolder in subFolders
my processFolder(aFolder, topFolder)
end repeat
end tell
end processFolder