Ich möchte Dateien in bestimmte Ordner kopieren. Die Ordnernamen und die Dateinamen haben die ersten 14 Zeichen gemeinsam. Dies ist meine Ordnerstruktur:Applescript Kopieren von Dateien in bestimmte Ordner
Die Quelldatei Struktur:
Proxy
RED_A001_0101R7 (the last 6 digits are random)
A001_C001_0101RN_001_Proxy.mp4 (video file to be copied)
A001_C002_0101D5_001_Proxy.mp4 (video file to be copied)
...
RED_A001_0525A1
RED_A002_010107
...
Die Zieldateistruktur:
FullRes
RED_A001_0101R7
A001_C001_0101RN.RDC (Folder in which the correct _Proxy file should be copied in)
A001_C002_0101D5.RDC (Folder in which the correct _Proxy file should be copied in)
...
RED_A001_0525A1
RED_A002_010107
...
Wie kann man leider manchmal zwei Ordner mit dem gleichen Ordnernamen beginnen (siehe aber unterscheiden sich durch die zufälligen Ziffern, die folgen)
Ich schaffte, das folgende Skript zusammenzufügen:
set ProxyFolder to (choose folder with prompt "Choose the Source Folder")
set FullresFolder to (choose folder with prompt "Choose the Destination Folder")
tell application "System Events"
set folderList to name of folders of FullresFolder
set fileList to name of files of ProxyFolder
end tell
repeat with i from 1 to (count folderList)
set folderName to item i of folderList
set beginFolderName to text items 1 thru 14 of folderName
set filesToMove to {}
repeat with j from 1 to (count fileList)
set filename to item j of fileList
if filename begins with beginFolderName then
set end of filesToMove to alias ((ProxyFolder as string) & filename)
end if
end repeat
tell application "Finder"
duplicate filesToMove to alias ((FullresFolder as string) & folderName & ":")
end tell
end repeat
Das Skript funktioniert - aber jetzt muss ich meinen Quell- und Zielordner für jeden Ordner A001, A002 usw. auswählen. Es wäre bequemer, in der Lage zu sein, die obersten Ordner als Quelle zu wählen (Folder Proxy) und Ziel (Ordner FullRes). Wie kann ich das machen?