Skip to content

Instantly share code, notes, and snippets.

@moekhalil
Created August 14, 2022 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moekhalil/ed388a0f7b7eb2715f600b38cdf41553 to your computer and use it in GitHub Desktop.
Save moekhalil/ed388a0f7b7eb2715f600b38cdf41553 to your computer and use it in GitHub Desktop.
Nested Folder File Counter
#!/bin/sh
# Usually sitting in my .bash_alias file
folderFileCounter() {
echo -e Directory: .\\\nFiles: `(/usr/bin/find . -maxdepth 1 -type f) | wc -l`
/usr/bin/find . -mindepth 1 -maxdepth 1 -type d -exec sh -c "echo Directory: {}\\\nFiles: \`/usr/bin/find {} -type f | wc -l\`\\\n" \;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment