Anyone have one of these handy? Im looking for something to search the current directory and below for *.avi and moves them to a defined direcotry.
thanks!
Anyone have one of these handy? Im looking for something to search the current directory and below for *.avi and moves them to a defined direcotry.
thanks!
I didn’t write this (but cannot remember who did) but it collects files by extension - in this instance .mp3, where the leading asterisk is a wild card. Set up a test on duplicates.
set target_folder to (choose folder with prompt "Where should the files be moved:") as alias
set the_files to paragraphs of (do shell script "find ~/ -name '*.mp3'")
set the_errors to {}
tell application "Finder"
repeat with this_file in the_files
try
move ((contents of this_file) as POSIX file) to target_folder
on error the_error
set end of the_errors to the_error
end try
end repeat
end tell
if the_errors = {} then
display dialog "All done." buttons {"OK"} with icon 1 giving up after 10
else
set AppleScript's text item delimiters to return
set the_errors to the_errors as string
set AppleScript's text item delimiters to ""
display dialog "All done with errors:" & return & the_errors buttons {"OK"} with icon 2
end if