File sorting replacing problem.

Joined
Jul 18, 2010
Messages
11
Reaction score
0
I am have made a folder action. It works in for the most part but where I am having a problem is it will not replace the file once it aready exists.

What I am tring to do is but files in alphabetitcal order based on the first letter of the file. and but it in the subfolder.

also if anyone can stream line this any better I am all ears. I have tried different replace commands I could come up with but it did not work.

Any help anyone could give I would be thankful

This is the Code that work with out the replacing function

tell application "System Events"
set these_files to every file of folder "Volumes:Member Pics"
repeat with i from 1 to number of items in the these_files
set this_item to item i of the these_files
set this_info to info for this_item
if visible of this_info is true then
set file_name to name of the this_item
set the first_char to (character 1 of the file_name) as string
beep 1
display dialog first_char buttons {"OK"} default button 1
if first_char is "a" then
move this_item to ":Volumes:Member Pics:a"
else if first_char is "b" then
move this_item to ":Volumes:Member Pics:b"
else if first_char is "c" then
move this_item to ":Volumes:Member Pics:c"
else if first_char is "d" then
move this_item to ":Volumes:Member Pics:d"
else if first_char is "e" then
move this_item to ":Volumes:Member Pics:e"
else if first_char is "f" then
move this_item to ":Volumes:Member Pics:f"
else if first_char is "g" then
move this_item to ":Volumes:Member Pics:g"
else if first_char is "h" then
move this_item to ":Volumes:Member Pics:h"
else if first_char is "i" then
move this_item to ":Volumes:Member Pics:i"
else if first_char is "j" then
move this_item to ":Volumes:Member Pics:j"
else if first_char is "k" then
move this_item to ":Volumes:Member Pics:k"
else if first_char is "l" then
move this_item to ":Volumes:Member Pics:l"
else if first_char is "m" then
move this_item to ":Volumes:Member Pics:m"
else if first_char is "n" then
move this_item to ":Volumes:Member Pics:n"
else if first_char is "o" then
move this_item to ":Volumes:Member Pics
redface.gif
"
else if first_char is "p" then
move this_item to ":Volumes:Member Pics
tongue.gif
"
else if first_char is "q" then
move this_item to ":Volumes:Member Pics:q"
else if first_char is "r" then
move this_item to ":Volumes:Member Pics:r"
else if first_char is "s" then
move this_item to ":Volumes:Member Pics:s"
else if first_char is "t" then
move this_item to ":Volumes:Member Pics:t"
else if first_char is "u" then
move this_item to ":Volumes:Member Pics:u"
else if first_char is "v" then
move this_item to ":Volumes:Member Pics:v"
else if first_char is "w" then
move this_item to ":Volumes:Member Pics:w"
else if first_char is "x" then
move this_item to ":Volumes:Member Pics:x"
else if first_char is "y" then
move this_item to ":Volumes:Member Pics:y"
else if first_char is "z" then
move this_item to ":Volumes:Member Pics:z"
end if
end if
end repeat
end tell
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top