Skip to content

Instantly share code, notes, and snippets.

@matt-42
Created September 14, 2016 14:46
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 matt-42/eb866b39f631fdec0c644f1442442ea8 to your computer and use it in GitHub Desktop.
Save matt-42/eb866b39f631fdec0c644f1442442ea8 to your computer and use it in GitHub Desktop.
Recursively traverse a filesystem
#! /bin/sh
rec() {
for f in `ls $2`; do
echo $1 $f
if [ -d "$2/$f" ]; then
rec $1-- "$2/$f"
fi
done
}
rec "|--" $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment