Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

expect script - searching a directory

Status
Not open for further replies.

davidbelarus

Programmer
Oct 21, 2011
26
0
0
US
gentlemen, a similar question.

i need to locate a file with specific attributes. [name, version, extension and not "debug"] string in its name. The name version and extension i have in separate strings inputted by the user.

i am working with find command rightnow.

have a nice day

david
 
What about something like:

Code:
foreach f [glob <directory path>/*.$extension] {
    if {[string first debug $f]<0} {
        #then $f is a filename without "debug"
        if {[string first $name $f]<0} {
           if {[string first $version $f]} {
           }
        }
    }
}

_________________
Bob Rashkin
 
That should be:
Code:
foreach f [glob <directory path>/*.$extension] {
    if {[string first debug $f]<0} {
        #then $f is a filename without "debug"
        if {[string first $name $f]>-1} {
           if {[string first $version $f]>-1} {
           }
        }
    }
}

_________________
Bob Rashkin
 
i spent all my time with the other code today. i will revisit this tomorrow. thanks again for giving me something to work with.
 
Note that if you know the general structure of the file name, like, say, $name*$version*.$extension, glob will take patterns like that.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top