Last active
May 16, 2017 10:26
-
-
Save istairbn/5fb0b0c1a6e60e0a543a6fedc5b5c8b8 to your computer and use it in GitHub Desktop.
Outputs a JSON file with the relative path as the key and the octal permissions as the value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#If path given as argument, that is used as the starting point. Else it starts from . | |
if [ -z "$1" ]; then | |
1="." | |
fi | |
echo "{" | |
SEP="" | |
find "${1}" | while read DIR | |
do | |
stat "${DIR}" -c "$SEP\"%n\":\"%a\"" | |
SEP="," | |
done | |
echo "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Addition to deal with spaces in file names