[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 'Inverse' chmod?



>Is there a command that will do (so to speak) the inverse of chmod, i.e. if
>given the name of a file return its current permissions in octal?

  perl -e 'printf "%#o", ((stat("FILENAME"))[2] & 0x1ff)'

Remove the # (leave everything else) to strip the leading 0

Carl


Reply to: