NAS File Permissions

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Nostalgist92
Posts: 3
Joined: 23 Mar 2014, 09:51

NAS File Permissions

Post by Nostalgist92 »

I've got FileBot running on my NAS pretty much exactly the way i want it but each time a file is renamed the permissions get changed to 666.

I've tried putting this in the command:

Code: Select all

"exec=chmod 775 "{file}""
Also tried

Code: Select all

"exec=chmod 775 -R "{folder}""
Both spit out this:

Code: Select all

Execute: chmod -R 775 /mnt/Storage/Media/Videos/TV/Criss Angel Mindfreak (2005)/Season 3
Syntax error: "(" unexpected
I can't figure out how to get it to ignore the brackets in the folder + file names.

Any ideas?
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: NAS File Permissions

Post by rednoah »

It's not about brackets, it's about spaces in the name and not using quotes.

Look at this carefully. Doesn't it look odd to you? How does shell handle multiple "..."..."..." and what does actually get passed in?

Code: Select all

"exec=chmod 775 -R "{folder}""
Lets find out!

Code: Select all

$ echo "exec=chmod 775 -R "{folder}""
exec=chmod 775 -R {folder}
Oh! Surprise! Exactly like in the error message! The quotes are missing!

Solution 1:

Code: Select all

$ echo "exec=chmod 775 -R \"{folder}\""
exec=chmod 775 -R "{folder}"
Solution 2:

Code: Select all

$ echo "exec=chmod 775 -R '{folder}'"
exec=chmod 775 -R '{folder}'
:idea: Please read the FAQ and How to Request Help.
Nostalgist92
Posts: 3
Joined: 23 Mar 2014, 09:51

Re: NAS File Permissions

Post by Nostalgist92 »

Awkward moment i even though of solution 2 with using the ' ' but ended up not testing..

Anyway thanks for the help. Proves just how tired when i was doing it considering i missed something else that was pretty simple as well.

Using just:

Code: Select all

"exec=chmod 775 -R '{folder}'"
will just spit out "No such file or directory"

What's needed is:

Code: Select all

"exec=chmod 775 -R '{folder}/'"
Dat trailing slash...

Cheers again!
Nostalgist92
Posts: 3
Joined: 23 Mar 2014, 09:51

Re: NAS File Permissions

Post by Nostalgist92 »

Also just throwing one more thing in there, the way my media is set up also requires a change in the ownsership of the files as well which can be done with:

Code: Select all

"exec=chmod 775 '{folder}/' ; chown owner:group '{folder}/'"
For the folder + subdir or

Code: Select all

"exec=chmod 775 '{file}' ; chown owner:group '{file}'"
For just the file that was renamed/moved
Post Reply