#!/bin/sh ## ## Nautilus ## SCRIPT: D0_anyfile4Dir_LIST_DIRS-HIDDEN_allLEVS_ls-AFR.sh ## ## PURPOSE: Lists ALL 'hidden' directories under a directory ## and shows the list in an editor of your choice. ## ## METHOD: Puts the output of the 'ls' command in a text file. ## ## Shows the text file in a text-file viewer of the ## user's choice. ## ## HOW TO USE: In Nautilus, select any file in the desired directory. ## Then right-click and choose this Nautilus script to run. ## ## Started: 2010mar09 ## Changed: 2010apr07 Chgd the way the OUTFILE is handled --- ## puts it in /tmp if no write permission ## to the 'current' (Nautilus) directory. ## Changed: 2010apr11 Touched up the comment statements. ## Changed: 2011may11 Get 'nautilus-scripts' directory via an include script. ## Changed: 2012feb29 Changed the script name in the comment above. ## FOR TESTING: (show the statements as they execute) # set -x ############################ ## Prepare the output file. ############################ CURDIR="`pwd`" OUTFILE="${USER}_temp_hiddenDirs.lis" if test ! -w "$CURDIR" then OUTFILE="/tmp/$OUTFILE" fi if test -f "$OUTFILE" then rm -f "$OUTFILE" fi ##################################### ## Generate a heading for the listing. ##################################### DATETIME=`date '+%Y %b %d %a %T%p'` echo "\ ..................... $DATETIME ............................ 'HIDDEN' DIRECTORIES under the directory $CURDIR ........................................................................... " > "$OUTFILE" ###################################### ## Add the 'ls' output to the listing. ###################################### ls -A -F -R | grep '/$' | grep '^\.' >> "$OUTFILE" ## The following SHOWS '.' and '..' subdirs: # find . -type d -name '.*' -print >> "$OUTFILE" ###################################### ## Generate a trailer for the listing. ###################################### SCRIPT_BASENAME=`basename $0` SCRIPT_DIRNAME=`dirname $0` echo " ........................................................................... This list was generated by script $SCRIPT_BASENAME in directory $SCRIPT_DIRNAME It ran the command ls -A -F -R | grep '/$' | grep '^\.' to find just the *hidden directories*. ..................... $DATETIME ............................ " >> "$OUTFILE" ###################### ## Show the list. ###################### ## . $HOME/.gnome2/nautilus-scripts/.set_VIEWERvars.shi . $HOME/.freedomenv/feNautilusScripts/set_DIR_NautilusScripts.shi . $DIR_NautilusScripts/.set_VIEWERvars.shi $TXTVIEWER "$OUTFILE" &