The copy is now done in all sub folders of the main folder (what ever the recursive level is.
The script bellow does what you want :
set MyFile to choose file with prompt "Select file to be duplicated in every folder"
set MyFolder to choose folder with prompt "Select the folder in which you want to copy the file"
tell application "Finder"
set SubFolders to every folder of entire contents of MyFolder
repeat with aFolder in SubFolders
duplicate MyFile to aFolder
I made assumption that you want to duplicate the selected file to all sub-folders of the selected folder. Then, I did not add recursive search for sub-folders of sub-folders of ...
In this script, I just used Applescript commands. You can replace the "duplicate" line with a do shell script command (using shell command 'cp'). However in this case the script must use posix path and quoted form...which is more complex than the simple Finder duplicate instruction !
Asked in February 2016Viewed 3,264 timesVoted 12Answered 1 times