applescript - Locate a file anywhere on the hard drive and transfer it to a different folder -
i'm trying create app transfer files name different folder. far, have following:
tell application "finder" move (every item of (get path home folder) name "extended image name.jpg") ((get path home folder) & "pictures" string) end tell
while doesn't return errors, doesn't want either. aware searches home folder, if there way broader search of whole drive without having enter username, great (i want able run on more computers 1 without them having edit script.)
-thanks
the code considers files in home folder not in subfolders, consider subfolders have add entire contents
tell application "finder" move (every item of entire contents of home name "extended image name.jpg") folder "pictures" of home end tell
but aware entire contents
extremely slow. shell command find
or spotlight search mdfind
faster example
set homefolder posix path of (path home folder) set picturesfolder posix path of (path pictures folder) shell script "mdfind -onlyin " & quoted form of homefolder & " -0 'kmditemdisplayname = \"extended image name.jpg\"' | xargs -0 -j {} mv {} " & quoted form of picturesfolder
important note:
as moving multiple files same name finder version ask overwriting , shell version overwrite files same name.
Comments
Post a Comment