List Amount Of Files In Current Location And Sub-Location

Discussion in 'Linux Guides' started by Chuck, Sep 6, 2018.

  1. Chuck

    Chuck Administrator
    Staff Member Grep What?

    Joined:
    May 17, 2017
    Messages:
    39
    Likes Received:
    0
    find . -maxdepth 1 -type d -print0 | while read -d '' -r dir; do num=$(find $dir -ls | wc -l); printf "%5d files in directory %s\n" "$num" "$dir"; done

    Will list amount of files in current location and all locations one level down.
     

Share This Page