您可以使用Automator.app在finder中创建服务。
打开Automator。
。
on run {input, parameters}
set theCsv to ""
repeat with i from 1 to number of items in input
tell application "Finder" to set this_item to displayed name of item i of input
set this_item to this_item & ",\\n"
set theCsv to theCsv & this_item
end repeat
do shell script "echo " & quoted form of theCsv & " > ~/Desktop/names.csv"
end run
现在,当您在finder中选择一个文件夹时,您可以使用上下文菜单在该文件夹上运行服务。
它将在列表的桌面上创建一个.csv文件。将在数字中打开。
注意:如果您有多个文件夹,它将为两个文件夹创建一个列表。可能只在第一个文件夹上使用它,或者两个都单独使用
更新:
一个快速的applescript示例,可以在选定的多个文件夹上工作。这将为查找器选择中的每个目录创建一个单独的文件
on run {input, parameters}
set theCsv to ""
set pathList to {}
repeat with i from 1 to number of items in input
tell application "Finder" to set the Cpath to container of item i of input as alias
if (Cpath as alias) is not in pathList then
copy Cpath to end of pathList
end if
end repeat
repeat with a from 1 to number of items in pathList
set this_item to item a of pathList
set thisFileName to ""
tell application "Finder" to set thisFileName to displayed name of (this_item as alias)
set the CSVpath to ""
repeat with i from 1 to number of items in input
tell application "Finder"
set the Cpath to container of item i of input as alias
if container of item i of input as alias is this_item then
set theName to displayed name of item i of input & ",\\n"
set CSVpath to CSVpath & theName
end if
end tell
end repeat
do shell script "echo " & quoted form of CSVpath & " > ~/Desktop/" & quoted form of thisFileName & ".csv"
end repeat
end run
UPDATE2。第二个示例现在使用文件夹名称作为文件名称