How to find number of files in every immediate sub-directory of $AW_HOME (UNIX/LINUX)?
search cancel

How to find number of files in every immediate sub-directory of $AW_HOME (UNIX/LINUX)?

book

Article ID: 89945

calendar_today

Updated On:

Products

CA Automic Applications Manager (AM)

Issue/Introduction

How to find number of files in every immediate sub-directory of $AW_HOME (UNIX/LINUX)?

Environment

Release: AAMOS499000-8.0-Automic Applications Manager-OS400 Agent
Component:

Resolution

Question:

How to find number of files in every immediate sub-directory of $AW_HOME (UNIX/LINUX)?


Answer:

Run the following command from $AW_HOME as the AM OS user:

> find . -type f -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c 

These results can be further sorted by number for files (decreasing order):

find . -type f -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn