Thursday, July 4, 2024

applescript – Need assistance w Apple Script studying textual content and copying recordsdata to new folder

I am needing assist with an AppleScript I have been utilizing. The present script I exploit reads a textual content file that incorporates pdf file names, after which strikes these to a unique folder. This one works nicely however I actually need it to only copy them as a substitute of transferring them. Might anybody probably assist with that?

# folders on totally different units
set path2source to decide on folder with immediate "Choose the supply folder" default location (path to desktop)
set path2dest to decide on folder with immediate "Choose the vacation spot folder" default location (path to desktop)
set path2list to decide on file with immediate "Choose your textList" of kind {"txt"}

set theList to paragraphs of (learn path2list)

inform utility "System Occasions"
    set theFiles to path of recordsdata of path2source
    set sourceList to {}
    repeat with aFile in theFiles
        if (identify of disk merchandise aFile) is in theList then
            set finish of sourceList to my quotedIt(aFile)
        finish if
    finish repeat
finish inform

do shell script "mv " & my recolle(sourceList, house) & house & quoted type of POSIX path of path2dest

#=====

on quotedIt(aFile)
    return quoted type of POSIX path of aFile
finish quotedIt

#=====

on recolle(l, d)
    native oTIDs, t
    set {oTIDs, AppleScript's textual content merchandise delimiters} to {AppleScript's textual content merchandise delimiters, d}
    set t to l as textual content
    set AppleScript's textual content merchandise delimiters to oTIDs
    return t
finish recolle

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles