劇本波紋管做你想做的(我想!)。
例:只選擇1個文件'1-surpername。jpg'文件夾'MyFolder'中,要求有2個重複的文件
'Myfolder'中的結果是'1-supername.jpg','2-supername.jpg','3-supername.jpg'
當然,如果選擇多個文件,每一個都會有同樣的待遇在各自的文件夾
tell application "Finder" to set MyFiles to selection
set NbFiles to count of MyFiles
if NbFiles = 0 then return
set Dupli to 0
set myAnswer to display dialog "There are " & NbFiles & " selected. How many duplicate do you want ?" default answer "1"
try
set Qty to text returned of myAnswer
on error
set Qty to 1
display dialog "Job cancelled. value entered incorrect"
end try
display dialog "Please confirm that you want to duplicate " & Qty & " times the " & NbFiles & " files selected ?"
repeat with F in MyFiles -- duplication for each selected file
set myName to name of F
set myFolder to POSIX path of ((folder of F) as string)
set AppleScript's text item delimiters to {"-"}
set ListName to text items of myName
set myCount to (item 1 of ListName) as integer
repeat with I from 1 to Qty -- for each duplication
set myCount to myCount + 1 -- counter of the begining of the file name
set item 1 of ListName to (myCount as string) --increase the counter for the new name
set newName to ListName as string
try
do shell script "cp " & quoted form of (myFolder & myName) & " " & quoted form of (myFolder & newName)
on error
display dialog "error during copy of " & myName & " into " & newName
end try
end repeat
end repeat
批處理文件標記爲Windows批處理文件編輯你的問題,並刪除該標籤 – Squashman
謝謝 - 。刪除 –
嗨,大家好,我正試圖從OSX轉移到Windows上(不要簽名 - 我聽到了!),我試圖找到一種在Windows 10上實現這一結果的方法。我知道這一點可能超出了這個原始問題的範圍,但我真的很努力地讓我的頭腦圍繞Windows腳本的工作原理:( –