I am using the following find command to list all the files recursively within a folder and sort it by size ( higest size being on top )
find . -not -path '*/\.*' -not -name '*.nfo' -type f -exec du -h {} + | sort -r -h
The command is working well but i need to strip off the full path from each result only retaining the filename
Eg.
Dir/AnotherDir/file.mp4 should be listed as file.mp4
Generally when i have to do this in find command , i simply use -printf '%f\n'
but this is can't be used in my current command as the files are being printed by du command
Just post process the data:
find ... | sort ... | sed -E 's@[[:space:]].*/@ @'
or
... | awk '{printf "%s\t%s\n", $1, $NF}' FS='\t\|/'