bash - `du` takes current directory when using in pipe with find -
i'm using script in file in directory (and of subdirectories) , print file + file's size.
it :
find $folder -name $file | du --apparent-size (with inputs $folder=folder_1 , $file=f1 problem output
4 ./folder_1/f1 8 ./folder_1 13 . whereas output of find $folder -name $file only
folder_1/f1/file1 folder_1/file1 why take current directory, if there no file matching search ?
try -exec option:
find "$folder" -name "$file" -exec du --apparent-size '{}' \;
Comments
Post a Comment