Created
September 20, 2014 11:16
-
-
Save mamiu/6f91a9ff400784ef1d8c to your computer and use it in GitHub Desktop.
The Mac version
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 | |
find . -type f -name '*' -print0 | while IFS= read -r -d '' file | |
do | |
name=$(basename "$file") | |
path=$(dirname "$file") | |
# full_path=$(readlink -f "$file") # This only works on Linux | |
full_path=$(echo "$PWD/${file#./}") | |
extension=${name##*.} | |
size_human_readable=$(ls -lh "$file" | awk -F' ' '{print $5}') | |
size_in_bytes=$(stat -f "%z" "$file") | |
creation_date=$(stat -f "%SB" "$file") | |
last_access=$(stat -f "%Sa" "$file") | |
last_modification=$(stat -f "%Sm" "$file") | |
last_change=$(stat -f "%Sc" "$file") | |
printf "[$file]:\n" | |
printf "\tfile name:\t\t$name\n" | |
printf "\tfile path:\t\t$path\n" | |
printf "\tfull file path:\t\t$full_path\n" | |
printf "\tfile extension:\t\t$extension\n" | |
printf "\tfile size:\t\t$size_human_readable\n" | |
printf "\tfile size in bytes:\t$size_in_bytes\n" | |
printf "\tfile creation date:\t$creation_date\n" | |
printf "\tlast file access:\t$last_access\n" | |
printf "\tlast file modification:\t$last_modification\n" | |
printf "\tlast file change:\t$last_change\n" | |
printf "\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment