0

I have looked around on the net for hours looking for this answer so I apologize if its there somewhere. This script below works fine except for the fact that it returns the .DS_Store file how can I exclude it from this query and all other hidden files for that matter but because I am creating the folder in my script the only one there is .DS_Store

tell application "System Events" set listOfInputs to POSIX path of every disk item of folder a as list end tell

Here is the full script below. I have been dropping files into the in folder after it is created but will eventually prompt for files before it is created.

on run

tell application "Finder"
    if not (exists folder "IN") then
        make new folder at desktop with properties {name:"IN"}
    end if
    if not (exists folder "OUT") then
        make new folder at desktop with properties {name:"OUT"}
    end if
end tell


set theINfolder to path to the desktop as string
set a to theINfolder & "IN:"


tell application "System Events"
    set listOfInputs to POSIX path of every disk item of folder a as list
end tell

set inputs to listOfInputs

set theOutfolder to path to the desktop as string
set outputFolder to theOutfolder & "OUT:"

set params to {}

main(inputs, outputFolder, params)

end run

4

2 回答 2

1

The following will work:

set listOfInputs to list folder a without invisibles

But without invisibles cannot be combined with POSIX path, so we use a loop instead:

set listOfInputs to {}
tell application "System Events"
    set the_items to list folder a without invisibles
    repeat with i from 1 to the count of the_items
        set this_item to alias ((a as Unicode text) & (item i of the_items))
        set end of listOfInputs to POSIX path of this_item
    end repeat
end tell
于 2013-01-10T22:39:09.207 回答
0

The List Folder command has been deprecated and may stop working unexpectedly.

Try:

set inFolder to (path to desktop as text) & "IN"
do shell script "mkdir -p " & quoted form of (POSIX path of inFolder)
set listOfInputs to paragraphs 2 thru -1 of (do shell script ("find " & quoted form of (POSIX path of inFolder) & " \\! -name \".*\""))

You can get the result as a string separated by spaces like this:

set inFolder to (path to desktop as text) & "IN"
do shell script "mkdir -p " & quoted form of (POSIX path of inFolder)
set {TID, text item delimiters} to {text item delimiters, " "}
set listOfInputs to paragraphs 2 thru -1 of (do shell script ("find " & quoted form of (POSIX path of inFolder) & " \\! -name \".*\"")) as text
set text item delimiters to TID
于 2013-01-11T04:56:38.820 回答