bash:directories:get_number_of_files_or_directories
BASH - Directories - Get Number of Files or Directories
#!/bin/bash if [ -d "$@" ]; then echo "Files found: $(find "$@" -type f | wc -l)" echo "Folders found: $(find "$@" -type d | wc -l)" else echo "[ERROR] Please retry with another folder." exit 1 fi
NOTE: Pass the directory name where you want to search for files from the command-line.
bash/directories/get_number_of_files_or_directories.txt · Last modified: 2021/01/26 15:21 by peter