DirectoryHasFile.sh is a Bourne Shell script that helps your custom shell scripts determine whether the specified directory contains any files. This script outputs a '1' for true and a '0' for false.
DirectoryHasFile.sh is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.
The original implementation of DirectoryHasFile.sh is too simple. It returns an 1 even if there are no files, but if the directory contains directories, symbolic links, etc. So I have updated it to only return 1 when it finds files. The new version is attached below.
I have improved this "DirectoryHasFile.sh" script further. You can now specify file masks to look for. If the directory contains files that matches the mask(s) you specify, it will return an 1. If you do not specify any file masks, then it will return an 1 if the directory contains any file. The new version is attached below.
DirectoryHasFile.sh "directory" [ "file mask 1" ... "file mask N" ]
Found a bug where if no files matches the last file mask, this script returns false even if the other file masks provides a match. I fixed the bug. Download the new version below.
Did your message disappear? Read the Forums FAQ.
Spam Control | * indicates required field
TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.
No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.
Messages, files, and images copyright by respective owners.
34 Users Online
Copyright © 1996 - 2024. All Rights Reserved.