Skip to content

Instantly share code, notes, and snippets.

@bak1an
Created January 26, 2012 16:55
Show Gist options
  • Save bak1an/1683758 to your computer and use it in GitHub Desktop.
Save bak1an/1683758 to your computer and use it in GitHub Desktop.
do ls for every directory in given path
#!/bin/bash
# Example of usage && output:
# $ls_path.sh /home/bak1an/Music
# drwxr-xr-x 6 root root 4.0K May 30 2011 /home
# drwxr-xr-x 226 bak1an bak1an 24K Jan 26 16:08 /home/bak1an
# drwxr-xr-x 112 bak1an bak1an 12K Nov 7 17:51 /home/bak1an/Music
path="$1";
while [[ $path ]]; do
echo -ne "$path\0";
path=${path%/*};
done | xargs -0 ls -ldh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment