#!/bin/csh -f # check_for_folders_hidden_by_index_htm # ------------------------------------------------------------------------- # Shell script to check the current folder for subfolders that would not # be easily browsable at the web server because an index.htm file will be # shown instead. Displays a message to standard output any found. # Returns 1 if found, else 0. # ------------------------------------------------------------------------- # Revision History: # $Log$ # ------------------------------------------------------------------------- set subs = "`find . -maxdepth 1 \ -type d \ -not -name thumbs \ -not -name slideshow \ -not -name . \ -not -name js \ -not -name album \ -not -name parent`" set links = "`find . -maxdepth 1 \ -type l \ -not -name thumbs \ -not -name slideshow \ -not -name . \ -not -name js \ -not -name album \ -not -name parent`" set sub_found = "false" foreach sub ($subs) if (-d "$sub" && ! -e "$sub.ignore_for_album_and_slideshow") then set sub_found = "true" endif end set link_found = "false" foreach link ($links) # Note: Yes, use -d here for links also. Returns true if the link # is to a directory. if (-d "$link" && ! -e "$link.ignore_for_album_and_slideshow") then set link_found = "true" endif end if ( ! -e .ignore_subfolders_for_album_and_slideshow \ && -e index.htm \ && ( "$sub_found" == "true" \ || "$link_found" == "true" \ ) \ ) then echo "----------------" echo "This folder has both an index.htm file and subfolders:" echo "----------------" ls -1 -dl index.htm foreach sub ($subs) if (-d "$sub" && ! -e "$sub.ignore_for_album_and_slideshow") then ls -dl "$sub" endif end foreach link ($links) if (-d "$link" && ! -e "$link.ignore_for_album_and_slideshow") then ls -dl "$link" endif end echo "----------------" echo "Such subfolders will not be easily browsable at the web server" echo "because the index.htm file will be shown instead of a" echo "directory listing. If you want to allow such subfolders to" echo "be hidden by the index.htm file, create a marker file with" echo "the name of each such subfolder and an extension of" echo '".ignore_for_album_and_slideshow". Or to allow it for all' echo "subfolders, create a single marker file with the name" echo '".ignore_subfolders_for_album_and_slideshow".' echo "----------------" exit 1 endif exit 0