How to change permissions to certain file pattern/extension?
use find: find . -name “*.sh” -exec chmod +x {} \;
use find: find . -name “*.sh” -exec chmod +x {} \;
It looks like it can be done using hooks and an auxiliary tool (and a little chewing gum and baling wire): Get David Hardeman’s Metastore, which saves and restores file metadata. Alter the sources so it will ignore directory .hg as well as .git. Use the following Mercurial hooks: precommit.meta = metastore -s changegroup.update = … Read more
This seems to work (thanks Evan, putting it here so the line is in context): buffer = “path/filename.zip” # zip filename to write (or file-like object) name = “folder/data.txt” # name of file inside zip bytes = “blah blah blah” # contents of file inside zip zip = zipfile.ZipFile(buffer, “w”, zipfile.ZIP_DEFLATED) info = zipfile.ZipInfo(name) info.external_attr … Read more
As far as I know the permission system in Linux is set up in such a way to prevent exactly what you are trying to accomplish. I think the best you can do is to give your Linux user a custom unzip one-liner to run on the prompt: unzip zip_name.zip && chmod +x script_name.sh If … Read more
Here’s a long, roundabout way of checking. USER=johndoe DIR=/path/to/somewhere # Use -L to get information about the target of a symlink, # not the link itself, as pointed out in the comments INFO=( $(stat -L -c “%a %G %U” “$DIR”) ) PERM=${INFO[0]} GROUP=${INFO[1]} OWNER=${INFO[2]} ACCESS=no if (( ($PERM & 0002) != 0 )); then # … Read more
Go to the Folder in Finder where the xcode project is and right click -> Get info. The permissions and the bottom should be set to read/write and in my case they were. The trick is to click the settings icon at the bottom and select “Apply to enclosed items”. The chmod method shown above … Read more
Here’s a table to help find the required flags for different permission combinations. ╔═════════════╦═════════════╦═══════════════════════════════╦════════════════════════╦══════════════════╦═══════════════════════╦═════════════╦═════════════╗ ║ ║ folder only ║ folder, sub-folders and files ║ folder and sub-folders ║ folder and files ║ sub-folders and files ║ sub-folders ║ files ║ ╠═════════════╬═════════════╬═══════════════════════════════╬════════════════════════╬══════════════════╬═══════════════════════╬═════════════╬═════════════╣ ║ Propagation ║ none ║ none ║ none ║ none ║ InheritOnly ║ InheritOnly … Read more
It might be enough to set the sticky bit on the directories. Users will be able to delete any files they own, but not those of other users. This may be enough for your use case. On most systems, /tmp is setup this way (/tmp is set 1777) chmod 1775 /controlled However, If you want … Read more
Specifying inheritance in the FileSystemAccessRule() constructor fixes this, as demonstrated by the modified code below (notice the two new constuctor parameters inserted between “FullControl” and “Allow”). $Acl = Get-Acl “\\R9N2WRN\Share” $Ar = New-Object System.Security.AccessControl.FileSystemAccessRule(“user”, “FullControl”, “ContainerInherit,ObjectInherit”, “None”, “Allow”) $Acl.SetAccessRule($Ar) Set-Acl “\\R9N2WRN\Share” $Acl According to this topic “when you create a FileSystemAccessRule the way you have, … Read more
os.stat is a wrapper around the stat(2) system call interface. >>> import os >>> from stat import * >>> os.stat(“test.txt”) # returns 10-tupel, you really want the 0th element … posix.stat_result(st_mode=33188, st_ino=57197013, \ st_dev=234881026L, st_nlink=1, st_uid=501, st_gid=20, st_size=0, \ st_atime=1300354697, st_mtime=1300354697, st_ctime=1300354697) >>> os.stat(“test.txt”)[ST_MODE] # this is an int, but we like octal … 33188 … Read more