Jump to content
Server Maintenance This Week. ×

Using Applescript to change folder permissions


This topic is 5847 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hey everyone. I am new to both Filemaker, Applescript, and this forum. Thanks for all of the helpful stuff you have posted here! It's a great forum.

I have been hunting around trying to find an answer to this, and I am sure it has probably been asked before on this forum, but I can't seem to find it.

We have a script in our FM9 file that uses Applescript to generate a folder on our desktop. We need to change the permissions on this folder to be 775 (Read/Write/Executable by both Owner and Groups). What would this Applescript look like?

Any help is much appreciated!

Link to comment
Share on other sites

  • 3 weeks later...

I'm trying to do almost the same thing... change the permissions of files and folders to 777, read/write access for owner, group, and everyone else. In terminal mode I have to say -R 777. In this shell script here I see only 775. If I just insert the 777 in place of the 775 will that work, or do I need the -R in there for something.

Thanks a lot.

Link to comment
Share on other sites

The -R makes it recursive, i.e. it will apply the permissions to all files and subfolders. I imagine you'll want to leave it in, if it's doing what you want.

Link to comment
Share on other sites

Thanks.

I tried the shell script as shown but I get an error that there is no such file or directory. I suspect I'm not using the right syntax for my mac (OS 10.3.9). I'm saying

do shell script "chmod 777 Chuck_HD:Users:chuck:Desktop:POSOE4batch.csv"

Where Chuck_HD is the name of the hard drive. Should that work?

Thanks a lot for the help.

Link to comment
Share on other sites

I think the path would start with /Users/ and would use slashes, not colons. Fire up Terminal and drag the file into the Terminal window, you'll see the path.

Link to comment
Share on other sites

Easiest Unix path to User's home folder is the shortcut: ~/

So their desktop is: ~/Desktop

This shortcut does not work in FileMaker syntax paths (unfortunately).

Also does not work if escaped, enclosed in single quotes: '~/'

Though you can enclose other parts of the path in single quotes where needed.

Link to comment
Share on other sites

You are correct, Fitch... the path starts /Users.. It works! Great! Thanks. And dragging the file into Terminal is a great trick. Thanks for the help.

Thank you, Fenton, for your input also. It really is great to be able to come here and get answers to things that have stumped me. ...It's unfortunate that stumping me is not that hard to do...

Thanks again.

Link to comment
Share on other sites

Well... now I've got the question that HAD to follow... can I do this (change permissions) to a file on a different computer on the LAN? I dragged the file into Terminal and it gave me /Volumes/username/... Which means I have to already be connected via OS (I think). Is there a way to do it without having to manually connect?

Thanks in advance, guys.

Link to comment
Share on other sites

You can mount a remote volume with AppleScript, example:


tell application "Finder"

	mount volume "afp://192.168.168.4/volume name" as user name "xxx" with password "yyy"

end tell

[P.S. The volume name can have spaces in the name, i.e. "Macintosh HD".]

[P.P.S. There may be a Unix way to change permissions without mounting the volume. I'm not that kind of geek :-]

Edited by Guest
Link to comment
Share on other sites

This topic is 5847 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.