So I’m doing this:
set fpath to (source folder)
set npath to (destination folder)
tell application "Finder"
set theFiles to every item in folder (fpath as alias)
set bob to list folder (fpath as alias)
repeat with i from 2 to length of bob --One seems to always be ".ds_store"
duplicate ((fpath & ":" & item i of bob) as alias) to folder (npath as alias)
set name of ((npath & ":" & item i of bob) as alias) to (text -8 thru -1 of ((100000000 + i) as string) & ".jpg") -- To get leading zeros
end repeat
end tell
While copying, the finder makes that little “twip” noise to let you know it did something.
Aside from muting the speakers, is there a way to prevent it from playing this noise?
Or in “leet speak”, I want to do this:
tell application "Finder" to STFU
On a related note, can any see a problem with simply using the below version instead? Eg: Is there any overhead cost associated with using “do shell script”? This script will eventually be used to process several hundred thousand (if not millions) of files. I want to make this as efficient as possible.
set fpath to (source folder)
set npath to (destination folder)
tell application "Finder"
set theFiles to every item in folder (fpath as alias)
set bob to list folder (fpath as alias)
repeat with i from 2 to length of bob --One seems to always be ".ds_store"
set src_file to (the POSIX path of ((fpath & ":" & item i of bob) as alias))
set dest_file to (POSIX path of (npath as alias)) & ((text -8 thru -1 of ((100000000 + i) as string) & ".jpg")) -- To get leading zeros
do shell script ("/bin/cp " & quoted form of src_file & " " & quoted form of dest_file)
end repeat
end tell
Thanks in advance!!