Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash script count directories in directory

#count dirs in current dir.  ex. dir tree:  /a/b/c, /a/c/b, /a/d/
dirCount() { echo $(find "$1"* -maxdepth 0 -type d | wc -l); }
declare -l _path="/a/"
echo $(dirCount "$_path") #outputs: 3
Comment

Count files and directories using shell script

find /path/to/directory | wc -l
Comment

PREVIOUS NEXT
Code Example
Shell :: vmware workstation merge vmdk files 
Shell :: for k in range bash 
Shell :: uninstall mongodb on macos completely 
Shell :: git diff previous commit 
Shell :: connect vm to cloud storage gcp 
Shell :: install to current directory pip 
Shell :: artisan route list naem 
Shell :: how to know on which port my mongodb server is running 
Shell :: ubuntu 20.04 vmware tools 
Shell :: get ram of ubuntu 
Shell :: simple way to make a text field to accept numbers only with maximum number of length 13 digit and min 10 
Shell :: please rebuild precompiled header 
Shell :: msiexec wait for completion powershell 
Shell :: serverless not using aws profile 
Shell :: shell for loop parameters 
Shell :: stop minecraft server command line 
Shell :: raspberry pi wifi setup wpa_supplicant 
Shell :: pocketsphinx install error 
Shell :: tar exclude directory 
Shell :: how to create a shortcut in a batch file 
Shell :: copy to clipboard in gihub readme 
Shell :: install pip 
Shell :: nmap linux 
Shell :: how to stop tomcat from cmd 
Shell :: reset one branch onto another 
Shell :: git transfer changes to another branch 
Shell :: ubuntu measure execution time 
Shell :: git push heroku master 
Shell :: grep --include 
Shell :: install docker-compose ec2 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =