I am using the du command in order to get the size of the folder. As I am interested in the actual size I ended up with the following command:
du –sh --apparent-size <someFolder>/ In this examples this returns 4.6M. However I know that the folder actually has exactly 4M and WinSCP confirms it (4096KiB).
So what command would I have to use to get "4M" as a result (Preferrably in a human readable format)?
Also please be aware that I also need to include all subfolders so that it has to be recursive. Folder structure is something like this:
_cache +-- _fold1 +-- _fold2 | +-- _fold2.1 | +-- file2.1.1 | +-- file2.1.... | +-- file2.1.5000 | +-- _fold2.2 | +-- file2.2.1 | +-- file2.2.... | +-- file2.2.5000 Thanks!
du -skordu -shwithout the--apparent-sizemodifier.1G. Although this might be the actual "size on disk" this is not the "real file size".a=0;find some_dir_name_here -type f | xargs ls -l| while read line; do b=$(echo $line|awk '{print $5}'); (( a=$a+$b ));done; echo "Size is " $a