Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using Applescript to change folder permissions

Featured Replies

  • 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!

You can use Applescript to invoke Unix like so:

do shell script "chmod 775 /path/to/file"

  • Author
  • Newbies

Perfect! It worked like a charm. Thank you!

  • 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.

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.

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.

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.

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.

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.

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.

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

Thanks Fenton. Haven't had a chance to try that yet, but thanks very much for the info.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.