Mit Hilfe von einigen Benutzern in diesem Formular konnte ich dieses Skript erstellen, unter dem Sie einen Ordner auswählen und dann auswählen können, welche Ordner in dem Ordner, den Sie in einen OneDrive Backup-Ordner rsync.Applescript: Need Help Resolving - Kann nicht jede Datei des besagten Ordners abrufen?
Grundsätzlich wurden von einem On-Site-Netzwerkspeicher auf OneDrive for Business migriert und möchten ein Skript erstellen, das so einfach wie möglich für unsere Benutzer ist.
Das Problem, das ich habe, ist, ich möchte nicht die Benutzer in der Lage sein, den ursprünglichen Ordner zu wählen, ich möchte die Variable nach vorne setzen.
Im Skript Ich verwende:
set theFolder to (choose folder with prompt "Please Choose The Root of Your H Drive Or The Folder That Looks Like: " & userName & "$")
Wenn ich benutze:
set theFolder to "/Volumes/MYERSMI5$/"
ich die Fehlermeldung "jede Datei des Ordners Can not Get" zu bekommen.
Wie stelle ich die theFolder
für dieses Skript vorzeitig ein, anstatt den Benutzer aufzufordern, den Ordner auszuwählen?
set OuserName to do shell script "whoami"
set userName to do shell script "echo " & OuserName & " | tr a-z A-Z"
tell application "Finder"
if not (disk userName exists) then
mount volume "SMB Server/" & userName & "$"
end if
delay 2
set theDialogText to "
- Mac H-Drive Migration Tool -
This Application Will Migrate a Copy of Your H Drive Data
to your OneDrive for Buisness Folder Locally on Your Mac
Migration Backup Location:
/Users/" & OuserName & "/OneDrive Folder/H-Drive Migration Backup
** Important **
In the Next Window Please Choose
The Root Folder of Your H Drive
The Drive Label Should Look Like: " & userName & "$"
display dialog theDialogText
set theFolder to (choose folder with prompt "Please Choose The Root of Your H Drive Or The Folder That Looks Like: " & userName & "$")
do shell script "mkdir -p ~/'OneDrive Folder'/'H-Drive Migration Backup'"
set HDriveBackupFolder to ((path to home folder as text) & "OneDrive Folder:H-Drive Migration Backup")
set AppName to "OneDrive.app"
tell application "Finder" to set Answer_ to exists application file ((path to applications folder as string) & AppName)
if Answer_ is false then
beep
beep
beep
beep
beep
end if
delay 1.5
tell application "Finder"
activate
set theFolderNames to name of folders of theFolder
set theChosenNames to (choose from list theFolderNames with prompt "Choose Which Folders to Backup, Please Hold Down The ⌘ Key To Choose Multiple Folders " with multiple selections allowed)
if (theChosenNames is false) then return
set HDriveBackupFolder to ((path to home folder as text) & "OneDrive Folder:H-Drive Migration Backup")
end tell
repeat with thisName in theChosenNames
tell application "Terminal"
do script ("rsync -avpz --delete " & (quoted form of POSIX path of ((theFolder as text) & thisName)) & space & (quoted form of POSIX path of HDriveBackupFolder)
end tell
end repeat
end tell
Der Finder akzeptiert keine POSIX-Pfade (durch Schrägstriche getrennt), sondern HFS-Pfade (Doppelpunkt getrennt) und AppleScript-Alias-Spezifizierer. Die Shell akzeptiert nur POSIX-Pfade, sonst nichts. Sie müssen die richtigen Pfadtypen übergeben. – vadian