我需要从excel的列中创建数千个文件夹。我环顾互联网并且已经接近了,但我需要命名结构
“LASTNAME,FIRSTNAME - ID”
每个都在excel的单独列中。 我已经尝试了下面的代码并且它可以工作,但是命名结构并不是我想要的。
display dialog " --Make Lotsa' Folders--
This AppleScript will create multiple folders using names from a text file that you specify."
set destination to (choose folder with prompt "Where would you like to make the folders?")
set textFile to (choose file with prompt "Select the text file you wish to use")
set folderNames to paragraphs of (read textFile)
repeat with oneName in folderNames
tell application "Finder" to make new folder at destination with properties {name:oneName}
end repeat
display dialog "Your folders are done." buttons {"OK"}
答案 0 :(得分:0)
请试试这个:
set destination to (choose folder with prompt "Where would you like to make the folders?")
tell application "Microsoft Excel" to set usedRange to string value of used range of sheet 1
repeat with i from 2 to (count usedRange)
tell item i of usedRange to set folderName to item 1 & ", " & item 2 & " - " & item 3
tell application "Finder" to make new folder at destination with properties {name:folderName}
end repeat
display dialog "Your folders are done." buttons {"OK"}
正如评论中所提到的,Finder在逐个创建文件夹时速度非常慢,这是一个更快的解决方案,保持解析Excel的方式(顺便说一句,这很快)但是使用shell {{1}带有组合参数列表的命令用于创建文件夹。
mkdir