I was hoping somebody out there could help me in this. I need a script to run automatically when you drop a folder from one server to a folder on a Mac, that will change all of the file permissions to all items in that folder to ReadWrite. Any where you can direct me?
Permissions are a property of Finder items:
tell application "Finder"
make new folder at desktop with properties {name:"aNewFolder", owner privileges:{read write}}
end tell
Hello, I saw this post by the admin:
Can anyone tell me if I can extend this script to set the Group-access privileges and the Others/access privilages upon execution?
Thanks.
From Finder’s dictionary:
Thank You I did see that, but when I take Adam’s Script and add the privilages nothing happens. Here’s the script:
tell application "Finder"
make new folder at desktop with properties {name:"aNewFolder", owner privileges:{read write}, group privileges:{read write}, everyones privileges:{read write}}
end tell
When I go to the newly created folder in the “Get Info” the privileges are owner - read write, Group - read only, Others - read only.
Any thoughts?
thanks
I recall reading that Finder has problems applying properties when making new items. Try making the change after the item has been created.
tell application "Finder"
make new folder at desktop with properties {name:"aNewFolder"}
tell result to set {owner privileges, group privileges, everyones privileges} to {read write, read write, read write}
end tell
Beautiful! Thanks Bruce!
That is neat to know. I’ve tried that and failed before too.
Works in this compressed form too:
tell application "Finder" to tell (make new folder at desktop with properties {name:"aNewFolder"}) to set {owner privileges, group privileges, everyones privileges} to {read write, read write, read write}
Sorry Guys,
I just tried it making the folder on my desktop and it’s fantastic, however when I target the folder to be made to a remote volume the permissions don’t take. Do you have a suggestion?
thank you
Thanks for this post guys!
if its use to anyone here is a repeat file script using the same reset permissions line from above:
tell application "Finder"
set sourceFolder to choose folder
set allFolders to every folder of entire contents of sourceFolder
set allFiles to every file of entire contents of sourceFolder
-- root folder
set theSourceFolder to folder sourceFolder
tell theSourceFolder to set {owner privileges, group privileges, everyones privileges} to {read write, read write, read write}
-- folders
set x to 1
repeat count of allFolders times
set thisFolder to item x of allFolders
tell thisFolder to set {owner privileges, group privileges, everyones privileges} to {read write, read write, read write}
set x to x + 1
end repeat
-- files
set x to 1
repeat count of allFiles times
set thisFile to item x of allFiles
tell thisFile to set {owner privileges, group privileges, everyones privileges} to {read write, read write, read write}
set x to x + 1
end repeat
end tell
Hi,
Depending on how you’re connected to the server where you want to create the folder and if your user has permissions to create a folder with read write privileges has a lot to do with it.
Here’s an example of making a folder the shell way:
set source_folder to choose folder
do shell script "mkdir -m 777 " & quoted form of POSIX path of ((source_folder as string) & "aNewFolder:")
Hope this helps,
Nik