Cynosure.X International LLC

: :

Add Comment | Related Links | TrackBack
Related Content

DirectoryHasFile.sh (GPL)

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.

Usage

DirectoryHasFile.sh "directory"

Attached File: DirectoryHasFile.sh (497 B)

Chieh Cheng
Mon, 13 Oct 2008 23:33:03 +0000

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.

Attached File: 1 - DirectoryHasFile.sh (841 B)

Chieh Cheng
Tue, 13 Jan 2009 00:04:44 +0000

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.

Usage

DirectoryHasFile.sh "directory" [ "file mask 1" ... "file mask N" ]

Attached File: 2 - DirectoryHasFile.sh (1 KB)

Chieh Cheng
Thu, 25 Jun 2009 22:28:25 +0000

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.

Attached File: 3 - DirectoryHasFile.sh (1 KB)

Chieh Cheng
Thu, 09 Feb 2017 02:16:52 -0800

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 1 + 7?
Click button only once, please!

TrackBack

TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

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.

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

94 Users Online

Hacking Digital Cameras
Fun for Photographers



Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.