Tuesday, November 21, 2017

how to take ios backup on external drive | apple script





--> Created by Deepak Lohia email at deepak9delhi@gmail.com for Only business queries. 
--> visit http://www.freevbatips.com for more 

set theOutputFolder to choose folder with prompt "Select the External folder for Backup !"
set theOutputFolder to POSIX path of theOutputFolder

set the ExFolder to findAndReplaceInText(theOutputFolder, " ", "\\ ")
on findAndReplaceInText(theText, theSearchString, theReplacementString)
set AppleScript's text item delimiters to theSearchString
set theTextItems to every text item of theText
set AppleScript's text item delimiters to theReplacementString
set theText to theTextItems as string
set AppleScript's text item delimiters to ""
return theText
end findAndReplaceInText

set msg to "Error"
tell application "Finder"
set displayappath to ("~/Library/Application\\ Support/MobileSync/Backup2" as text)
if exists displayappath then
set msg to displayappath & " Exists - Oops , seems like you have already ran the script."
display dialog msg
quit
end if
end tell

--display dialog "Folder will be created on " & theOutputFolder & "Backup"
--display dialog theOutputFolder

tell application "Terminal"
activate
if not (exists window 1) then reopen
set window_id to id of first window whose frontmost is true
--> CREATING FOLDER IN EXTERNAL DRIVE FOR BACKUP
do script ("mkdir -p " & ExFolder & "Backup") in window id window_id of application "Terminal"
--> RENAMING EXISTING BACKUP FODLER TO BACKUP2
do script ("mv ~/Library/Application\\ Support/MobileSync/Backup ~/Library/Application\\ Support/MobileSync/Backup2") in window id window_id of application "Terminal"
--> CREATING SYMBOLIC LINK TO THE EXTERNAL DRIVE FOLDER
do script ("ln -s " & ExFolder & "Backup ~/Library/Application\\ Support/MobileSync/") in window id window_id of application "Terminal"
display dialog "Folder created on " & theOutputFolder & "Backup - for iOS Backup"
end tell



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.