Hi Guys
Was wondering if any of you could help me. I've trawled the internet to find a solution to automating something at work. I need a script that will copy files into specific folders dependent on their file names. I found a script that seemed to work but one of the things I need it to do is replace any files in the destination folders if files of the same file name exist. I have a 'with replacing' term in there but it doesn't seem to work. I'm at a bit of a loss now.
Here's my code,
Any help will be appreciated.
Thanks in advance.
Thom
Was wondering if any of you could help me. I've trawled the internet to find a solution to automating something at work. I need a script that will copy files into specific folders dependent on their file names. I found a script that seemed to work but one of the things I need it to do is replace any files in the destination folders if files of the same file name exist. I have a 'with replacing' term in there but it doesn't seem to work. I'm at a bit of a loss now.
Here's my code,
Code:
property One : "Macintosh HD:Users:macuser:Desktop:Test:One" as alias
property Two : "Macintosh HD:Users:macuser:Desktop:Test:Two" as alias
property Three : "Macintosh HD:Users:macuser:Desktop:Test:Three" as alias
property ErrorIn : "Macintosh HD:Users:macuser:Desktop:Test:ErrorIN" as alias
property FileIn : "Macintosh HD:Users:macuser:Desktop:Test:Review Images" as alias
try
tell application "Finder" to set theFiles to files of FileIn
set theList to files of theFiles
repeat with aFile in theFiles
set FileName to name of aFile as text
try
if FileName contains "one" then
move aFile to One with replacing
else if FileName contains "two" then
move aFile to Two with replacing
else if FileName contains "three" then
move aFile to Three with replacing
else
move aFile to ErrorIn with replacing
end if
end try
end repeat
end try
Any help will be appreciated.
Thanks in advance.
Thom
Last edited: