applescript - Mac Copy directory to any directory created in another directory -


so have directory users copy folders into. i'd setup automated way of copying predefined directory folder added original root folder.

to explain mean:

i have root folder /root. users can copy folder /root. when do, i'd copy /addins/images folder /root/<user created folder>/ directory automatically. result should /root/<user created folder>/images - including sub directories , files in /addins/images folder.

i've heard automator might able such thing have no idea how use it. any/all appreciated.

you can automator or applescript, using action folder.

the applescript bellow copy folder images (located in addins) new folder added myroot folder.

on adding folder items myroot after receiving filelist set addins posix path of "users:your_path:addins:images" set folderkind "folder" -- value depends of system language tell application "finder" -- loop on each item aded folder repeat one_item in filelist     if (kind of one_item) folderkind -- user has added folder         shell script "cp -r " & (quoted form of addins) & " " & quoted form of (posix path of one_item)     end if end repeat -- end loop on each added item end tell end adding folder items 

you must change path folder addins/images (line 2).

once compiled in applescript editor, save script in ~library/scripts/folder action scripts. then, in finder, select folder "/root" , right click add folder action on (this folder action !). then, each time folder added in folder, script run.(because of "if" row 6, run when folder added, not simple file)

warning: concerned /root folder using , hope not real root folder, example. if not have authorization issues real root folder.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -