If I was using linux or cygwin I could use stat --format=%a
as described here.
But instead I want to use only the tools available in msysgit by default. My main options seems to be parsing the output of ls, but that is not very palatable:
drwxr-xr-x 0 jaxelson Administ 0 Jul 13 2009 PrintHood/
dr-xr-xr-x 0 jaxelson Administ 8192 Jan 3 09:22 Recent/
Are there any easier ways?
Back History:
I need to do this because of a bug in sed
where it doesn't preserve permissions correctly. For more info see this.
Also the script that is running sed
is running as a git-hook
.
You could use
perl -e'printf "%o\n",(stat shift)[2] & 07777' <filename>