Restricting 'du' to child directories only?
I'm trying to write a script that uses the 'du' command to make essentially a text-based filelight type program.
It should scan the current directory for the file's sizes and display them in order largest to smallest (or vice versa). The user should be able to go throughout the file tree and see child directories scanned for the sizes as they're accessed.
I just need to know one more thing- how can I restrict the displayed results to the current working directory? would a grep for the output of pwd suffice? just getting some thoughts before i try and possibly dig myself a hole.
You can use the ls command, with options for long listing, recursive search, sort by file size, current working directory: ls -lRS $PWD
You can then pipe the results through awk to show only the fields of interest in the output.
|All times are GMT -5. The time now is 12:56 AM.|