Computing.Net > Forums > Unix > search for files & directories

search for files & directories

Reply to Message Icon

Original Message
Name: elizazabeth omiteru
Date: February 14, 2003 at 10:38:20 Pacific
Subject: search for files & directories
OS: solaris
CPU/Ram: 20g
Comment:

How can i search for files and directories foe this set of files. the command line of how the scrupt should be exited is
$ script5 /export/home/studen1 myfile1 myfile2

script5 - name of the shell script
/export/home/studen1 - directory in which the search should begin
myfile1, myfile2 - files to search for


Report Offensive Message For Removal

Response Number 1
Name: WilliamRobertson
Date: February 15, 2003 at 08:47:54 Pacific
Subject: search for files & directories
Reply: (edit)

Try this:

#!/bin/ksh

searchpath=$1

shift

filelist="$@"
filespec="( "
or=""

for f in ${filelist}
do
filespec="${filespec} ${or} -name ${f}"
or="-o"
done

filespec="${filespec} )"

print find ${searchpath} ${filespec}

find ${searchpath} ${filespec}


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: search for files & directories

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software