Cynosure.X International LLC

: :

Add Comment | Related Links | TrackBack
Related Content

FileExists.sh (GPL)

FileExists.sh is a Bourne Shell script that helps you determine whether any file that matches your specified file masks exists. This script will return 1 or 0, which represents true and false respectively. This script returns true when one or more files are found using any of the file masks you specified on the command-line. Using this script, your other scripts can easily determine whether some files exist.

FileExists.sh is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.

Usage

FileExists.sh mask1 [ . . . mask2 ]

Examples

: FileExists.sh "*.sh"
1
: FileExists.sh "*.woefj"
0
: FileExists.sh "*.sh" "*.woefj"
1

Attached File: FileExists.sh (555 B)

Chieh Cheng
Fri, 02 May 2008 20:43:50 +0000

By the way, you can use this utility to test for files that are not in the current directory. In fact, you can test for files in multiple directories and this utility will return '1' if the file mask is found in any of the specified directories. Following are some examples.

Examples

  FileExists.sh "bin/*.java"

FileExists.sh "src/*.class"

FileExists.sh "bin/*.java" "src/*.class"

Chieh Cheng
Mon, 22 Dec 2008 07:45:26 +0000

what does 1 and 2 in line 25 stand for ???

debayan
Sat, 27 Dec 2008 08:26:17 +0000

"-1" is a "ls" flag to display file names in a single column. "2>" redirects stderr; in this case, redirects to /dev/null, which just throws away the stderr output.

Chieh Cheng
Sat, 27 Dec 2008 08:49:35 +0000

Found an incompatibility issue with Ubuntu 12.10. This new attached version below resolves the incompatibility.

Attached File: 1 - FileExists.sh (762 B)

Chieh Cheng
Tue, 19 Mar 2013 02:09:59 +0300

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 7 + 8?
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

41 Users Online

Hacking Digital Cameras
Fun for Photographers


Get Our

Memecoins!



Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.