Discuss Apple Script at the Genuine Mac Support - Hackint0sh.org; Originally Posted by JayBird
JUST CHECKED SCRIPT:
do shell script "cp -R $HOME/ DOWNLOADS /Volumes/ ...
-

Originally Posted by
JayBird
JUST CHECKED SCRIPT:
do shell script "cp -R $HOME/DOWNLOADS /Volumes/USB/"
WORKS 100% VERY VERY HAPPY
Great hearing that!
BTW: I dont know Candybar, sorry
Read the stickies and search the forum before posting!
If you want to become a Hackint0sh supporter
click here
----------
iPhone 4 factory unlocked, iOS 4.3.1, jailbroken
iPad Wi-Fi + 3G (1G), iOS 4.3.1, jailbroken
iPad 2
-
-
Senior Professional
Array
is there a way to attach an icon to the script so when you compile it, it will link the image rather than show an apple script icon???
also i understand that the script below does copy files ect over,
is there anyway i can get it to show as if i had dragged the files onto the drive (when you see the blue bar + time)??
Last edited by JayBird; 02-10-2009 at 04:32 PM.
Reason: Extra Q
I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner
iPhone Owner 3G
-
-

Originally Posted by
JayBird
is there a way to attach an icon to the script so when you compile it, it will link the image rather than show an apple script icon???
also i understand that the script below does copy files ect over,
is there anyway i can get it to show as if i had dragged the files onto the drive (when you see the blue bar + time)??
1. Once you created the app, just klick on it once in the Finder, then hit command-I (Information). All the way on the top you see the icon. It can be replaced via copy->paste, very easy.
2. Yes it does cpoy files etc over
3. As far as I know the only reliable way would be to create an AppleScript Studio project, but this is not that easy. i dont know of a way to just use AppleScript, never had a reason to look into that. I see your reason for it. Will let you know if I find something you can use.
Read the stickies and search the forum before posting!
If you want to become a Hackint0sh supporter
click here
----------
iPhone 4 factory unlocked, iOS 4.3.1, jailbroken
iPad Wi-Fi + 3G (1G), iOS 4.3.1, jailbroken
iPad 2
-
Senior Professional
Array
one last question, i have been looking into apple script and the -R , what is the main reason to using the R (all explanations i read don't make sense).
Also when it does the copy does it go directly to the drive, i don't know how but 7GB of space has been taken up in the last 2 hrs on my machine and i can't find where from.......
I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner
iPhone Owner 3G
-
-

Originally Posted by
JayBird
one last question, i have been looking into apple script and the -R , what is the main reason to using the R (all explanations i read don't make sense).
Also when it does the copy does it go directly to the drive, i don't know how but 7GB of space has been taken up in the last 2 hrs on my machine and i can't find where from.......
You need -R cause cp alone wont copy folder, just single files.
One question on the command
do shell script "cp -R $HOME/DOWNLOADS /Volumes/USB/"
Did you write it that way, it wont work I am afraid (upper and lower case matter
would be
do shell script "cp -R $HOME/Downloads /Volumes/USB/"
but only if the external volume you are copying the backup to is named "USB" - meaning showing up in the Finder as Volume "USB".
Please check this
Read the stickies and search the forum before posting!
If you want to become a Hackint0sh supporter
click here
----------
iPhone 4 factory unlocked, iOS 4.3.1, jailbroken
iPad Wi-Fi + 3G (1G), iOS 4.3.1, jailbroken
iPad 2
-
Senior Professional
Array
hey i have writen it like:
o shell script "cp -R $HOME/Downloads /Volumes/USB/" - USB being name of external Drive
I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner
iPhone Owner 3G
-
-
Senior Professional
Array
Last edited by JayBird; 02-10-2009 at 10:46 PM.
I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner
iPhone Owner 3G
-
Supporter Array
Try it like this
Change SourceFolder and TargetFolder to match yours
-------Copy from here ------------------
---------------------------------------
set SourceFolder1 to path to (home folder)
set SourceFolder to POSIX path of SourceFolder1 & "/Downloads/"
set TargetFolder to "/Volumes/USB/"
---------------------------------------
set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
repeat
set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")
display dialog "Copied " & TSize & "Kb of " & SSize & "Kb" giving up after 1
if (TSize as number) is (SSize as number) then exit repeat
end repeat
----------To here----------
It will give you a progress indicator
Zeljko
-
-
Senior Professional
Array
if i wanted to add more, folders in, for example MOVIES / PICTURES would it look like this?
-------Copy from here ------------------
---------------------------------------
set SourceFolder1 to path to (home folder)
set SourceFolder to POSIX path of SourceFolder1 & "/Downloads/"
set SourceFolder to POSIX path of SourceFolder1 & "/Movies/"
set SourceFolder to POSIX path of SourceFolder1 & "Pictures/"
set TargetFolder to "/Volumes/USB/"
---------------------------------------
set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
repeat
set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")
display dialog "Copied " & TSize & "Kb of " & SSize & "Kb" giving up after 1
if (TSize as number) is (SSize as number) then exit repeat
end repeat
I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner
iPhone Owner 3G
-
Supporter Array
unfortunately you can't do it like that, cos every time you issue a "set SourceFolder to" you overwrite the previous one.
you can do it like this:
---------------------------------------
set SourceFolder1 to path to (home folder)
set SourceFolder to POSIX path of SourceFolder1 & "/Downloads/"
set SourceFolderMOV to POSIX path of SourceFolder1 & "/Movies/"
set SourceFolderPIC to POSIX path of SourceFolder1 & "/Pictures/"
set TargetFolder to "/Volumes/USB/"
---------------------------------------
set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
set SSizeMOV to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
set SSizePIC to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
do shell script "cp -R " & quoted form of SourceFolderMOV & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
do shell script "cp -R " & quoted form of SourceFolderPIC & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
repeat
set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")
display dialog "Copied " & TSize & "Kb of " & ((SSize as number) + (SSizeMOV as number) + (SSizePIC as number)) & "Kb" giving up after 1
if (TSize as number) is ((SSize as number) + (SSizeMOV as number) + (SSizePIC as number)) then exit repeat
end repeat
----------------------------------------
or you can simplify it and do it like this:
--------------------------------------
set SourceFolder1 to path to (home folder)
set SourceFolder to POSIX path of SourceFolder1
set TargetFolder to "/Volumes/USB/"
---------------------------------------
set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
repeat
set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")
display dialog "Copied " & TSize & "Kb of " & SSize & "Kb" giving up after 1
if (TSize as number) is (SSize as number) then exit repeat
end repeat
------------------------------------------
this will copy your whole Home folder to a backup destination
another thing is , you can download a program called "Do Something When" , and program it to run the script every time you insert this specific external USB disk.
(no affiliation to azarhi software)
Hope it helps
if I can help further just let me know
Zeljko
Last edited by Amet; 02-16-2009 at 11:19 PM.
-
Similar Threads
-
By hackint0sh in forum Latest Headlines
Replies: 0
Last Post: 01-04-2011, 04:20 AM
-
By jaybee16 in forum AppleTV 1
Replies: 1
Last Post: 07-17-2009, 04:00 AM
-
By dbenc in forum General
Replies: 0
Last Post: 02-19-2008, 01:29 AM
-
By hiimcliff in forum iPhone "2G" (Rev. 1)
Replies: 0
Last Post: 01-18-2008, 04:27 PM
-
By Japka in forum Genuine Mac Support
Replies: 0
Last Post: 12-13-2007, 06:24 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks