如何在文件夹和子文件夹名称前添加数字?
我的脚本在这里用于“文件夹制作工具”,我可以在主文件夹上添加一个数字但是如何为所有文件夹和子文件夹添加相同的编号?请帮忙。谢谢。
property structure : {"Contract Proposals", {"Contracts and proposals", {"Owner", "Architect", "Consultant", "General contractor"}, "Scope of work"}, "Existing Conditions", {"Base building information", "Owner provided drawing (can be CAD)", "Lease documents", "Building reports/environmental reports", "Surveys"}, "Programming", {"Questionnaires/spreadsheets", "Interviews/meeting minutes", "Adjacency matrix and diagrams"}, "Code-Permit", {"Approvals", "Zoning/building permit applications", "Permit documentation submitted", "Research section scanned", "Summary of code research", "Correspondence"}, "Design Sketches", {"Existing conditions (field verified)", {"Sk0"}, "Schematic design", {"Preliminaries", "Sk1 through x"}, "Design development", {"Sk1 thru x"}, "Renderings/presentations (dated)"}, "Construction Documentation", {"Construction documents (dated)", {"Sheet specs"}, "Specifications", "ComCheck/resCheck", "Supplemental drawings (dated)", {"Sd1 thru x"}, "Bulletins/addenda", "Design info/backgrounds (to/from consultants)"}, "Bidding", {"List of contractors", "Instructions to bidders", "Bids received", "Bid comparison"}, "Contract Administration (CA)", {"Payment approvals/bids", "Field notes/meeting minutes", "Pay applications", {"Incoming & reviewed"}, "Change order requests", {"Log", "Reviewed", "Approved"}, "Submittals", {"Log", "Submittals", "Reviewed submittals"}, "Request for info (RFI)", {"Log", "RFI's", "RFI responses"}}, "Close-Out", {"Punchlist", "Warranties", "Lien releases", "Certificate of occupancy", "Meeting minutes", "Meeting agendas", "Finished form of presentation (PDF or PPT)"}, "Product Info", {"Cut sheets", "Installation manuals", "Instruction manuals", "CAD block of fixture"}, "Cost Data", {"Cost estimates", "Cost analysis", "Bill of materials", "RSMeans information", "General contractor proposals/bids", "Vendor bids"}, "Communication", {"Email correspondence (dated)", "Meeting minutes (# and date)", "Client", {"Incoming", "Outgoing"}, "Contractor", {"Incoming", "Outgoing"}, "Consultant", {"Incoming", "Outgoing"}}}
set j_name to text returned of (display dialog "Enter Job Name:" default answer "job name")
repeat
try
set j_number to text returned of (display dialog "Enter Job Number:" default answer "0")
if (j_number as integer) < 10000 and ¬
(j_number as integer) > -1 then exit repeat
on error errMess number errNum
if errNum is -128 then error errMess number errNum
display alert "Error" message "Project Number is not a number or is out of range."
end try
end repeat
set j_number to text -5 thru -1 of ("0000" & j_number & " ")
set structure to {j_number & j_name} & {structure}
makeFolderStructure out of structure at (choose folder with prompt "Choose parent folder for structure")
to makeFolderStructure out of someItem at someFolder
set currentParent to someFolder
if class of someItem is not list then set someItem to {someItem}
set completed to true
repeat with anItem in someItem
if class of anItem is list then
makeFolderStructure out of anItem at currentParent
else --
tell application "Finder" to try
make new folder at someFolder with properties {name:(anItem as text)}
set currentParent to result as alias
on error errMess number errNum
if errNum is -48 then
set currentParent to ((someFolder as text) & (anItem as text)) as alias
else
set completed to false
end if
end try
end if
end repeat
return completed
end makeFolderStructure
答案 0 :(得分:0)
bash
。将以下内容保存在名为HOME
的{{1}}目录中的文件中。
$HOME/go
然后启动#!/bin/bash
read -p "Enter the prefix number: " prefix
mkdir -p "$HOME/Desktop/Result"
cd "$HOME/Desktop/Result"
mkdir -p "${prefix}Bidding"
mkdir -p "${prefix}Close-Out"
mkdir -p "${prefix}Code-Permit"
(键入命令+空格并开始键入Terminal
直到猜到,然后按Terminal
)并在Enter
中键入以下内容以使脚本可执行 - 按结束时的Return / Enter键:
Terminal
然后在Finder中双击chmod +x go
,它会询问您的问题并在桌面上的$HOME/go
文件夹中创建文件夹。
它没有做你说的一切,但你应该能够从那里开始。