Created
August 4, 2016 08:05
-
-
Save vu3jej/61bf096116e45e3e85be1fd78e6317d9 to your computer and use it in GitHub Desktop.
Print immediate parent directory along with filename and the file size
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 | |
for filename in $(find . -type f -print) | |
do | |
du_out=$(du -s $filename) | |
splitted=($(echo ${du_out})) | |
size="${splitted[0]}" | |
abs_path="${splitted[1]}" | |
parent_dir=$(basename $(dirname "$abs_path")) | |
filename=$(basename "$abs_path") | |
echo "${parent_dir},${filename},${size}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment