I am going to be using the command “cp -rv” to copy a folder in verbose mode in applescript. I want to have a dialog monitor the progress by showing what file it is copying. I’m really not sure what the best way would be to do this line by line, so if anyone knows I would greatly appreciate the help. Thanks in advance.
I don’t think that this is possible because do shell script only returns when it is complete. See TN2065 “do shell script in AppleScript”
Why can’t you just use the plain old copy? You’ll get a nice modal copy dialog.
I don’t think this will work because it is copying hidden folders.
This is a rough guess, but it will cycle through the items and display a dialog with the current file being copied. The problem is that it delays one second for each file. This is not a problem if you are copying 20 files, but if you are copying 20,000 it might be a tad slow.
Andy
set source_folder to choose folder
set file_list to list folder source_folder
tell application "Finder"
set folder_path to POSIX path of source_folder
--Make a backup folder at the desktop if it does not exist
try
make new folder at desktop with properties {name:"Backup"}
end try
--Copy the files
repeat with file_ in file_list
set name_ to quoted form of (folder_path & file_ as string)
set copy_script to "cp " & name_ & " ~/Desktop/Backup"
display dialog "Now copying " & name_ giving up after 1
do shell script copy_script
end repeat
end tell