i’ve some problems using copy -for some- folders from my HD to a external drive. What’s missing?
do shell script "cp '/Users/Home/Library/iTunes/' '/Volumes/Backup'"
i’ve some problems using copy -for some- folders from my HD to a external drive. What’s missing?
do shell script "cp '/Users/Home/Library/iTunes/' '/Volumes/Backup'"
First you need option -R for copying directories. Second, the source directory should end with no ‘/’ because now cp tries to copy it’s content instead of the directory. And third you should use quoted form instead trying it yourself.
do shell script "cp -R " & quoted form of posix path of sourceDirectory & " " & quoted form of posix path of targetDirectory
When you mix up folders and files to copy it’s easier to use ditto
do shell script "ditto " & quoted form of posix path of sourceDirectory & " " & quoted form of posix path of targetDirectory
Hi guys,
thanks for the nice feedback! :lol:
(i’m still experimenting with shell commands, but with some caution.)
i’ve another question:
how to ignore hidden and locked folders in a find syntax? (like .Spotlight-V100, ect.)
my current syntax returns errors using Applescript.
set cmd to "find " & quoted form of POSIX path of (path to home folder as text) & " -iname *.png"
do shell script cmd
you’re welcome. What error do you get because your command works perfect on my machine with no errors at all.
Hi,
in Applescript, i get:
in Terminal everything runs fine.
Find sends errors to stderr. If you don’t want to retrieve errors from the shell simply use
set cmd to "find " & quoted form of POSIX path of (path to home folder as text) & " -iname *.png"
do shell script cmd & " 2> /dev/null"