Cynosure.X International LLC

: :

Add Comment | Related Links | TrackBack
Related Content

where.sh (GPL)

where.sh is a command-line shell script utility that will help you load files with specific regular expression. It starts in the current directory and looks under all subdirectories. It uses the UNIX "find" utility but doesn't require you to remember all of the command-line arguments. In addition, it suppresses all of the error messages that "find" generates. Suppress of the error messages are very helpful on UNIX system where you don't have access to many of the subdirectories. where.sh is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.

Usage

  where.sh "file name expression"

You must surround file name expression in double-quotes.

Example

  where.sh "*.zip" 

Locates all files with the "zip" extension.

  where.sh "CRW_7???.RAW" 

Locates all raw images in the 7000 series.

Attached File: where.sh (213 B)

Chieh Cheng
Tue, 27 Dec 2005 13:17:38 -0800

Today, I needed to find all UNIX hidden files (starts with a period) in a sub-directory tree. But every time I issued

  ls .*
, I get back everything all files in the current directory and all files in the parent directory. That is because the mask matches the "." and ".." directory entries as well. Finally, I optimized down to
  ls .??*
, which weeded out "." and "..", but ignores hidden files with one and two character names.

Eventually, it occurred to me that this where.sh script can easily help me out. And sure enough, issuing

  where.sh ".*"
on the command line got me exactly what I wanted in mere seconds. Only if I could have thought of it that fast.

Chieh Cheng
Sat, 11 Oct 2008 20:56:45 +0000

I've beefed up the where.sh script so that it does more error checking and remove the writing to a temporary file. In addition, it now accept multiple file masks, to search for, on the command-line.

Usage

  Usage:   where.sh "file mask 1" [ . . . "file mask N" ]

You must surround file masks in double-quotes.

Example

  where.sh "*.zip" "CRW_7???.RAW"

Locates all files with the "zip" extension and all raw images in the 7000 series.

Attached File: 1 - where.sh (378 B)

Chieh Cheng
Fri, 02 Jan 2009 20:11:23 +0000

Recently, I have installed quite a few virtual machines on my notebook computer. The virtual machines all share common folders, which are mounted via symbolic links. "where.sh" breaks down, because it does not search into symbolic links.

Therefore, I've modified "where.sh" so that it does. The new version is attached below.

Attached File: 2 - where.sh (381 B)

Chieh Cheng
Fri, 15 May 2015 02:53:26 +0400

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 6 - 1?
Click button only once, please!

TrackBack

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

Hacking Digital Cameras
Fun for Photographers


Amazon Associate

Copyright © 1996 - 2017. All Rights Reserved.