Click to See Complete Forum and Search --> : Can we find a directory according to its contents


surjyap
September 28th, 2005, 04:30 AM
consider a directory which have a certain criteria. e.g. the directory should contain a certain type of files and it may contain directories also. let say the file types are with extension "*.eof" and "*.neof". So a single directory can contain either eof file or neof file, but not both.

let say in the current directory has sub directories A,B,C and D.
The directory A contains some eof files and directories A1,A2 etc. Now my requirement is to find the directory which contains eof files usnig find command. But find command in nature recursively looks for the files irrespective of length of path.But I want to restrict it. As it will find the directory A contains eof files the find command should not look into subdirectories under the directory A.

In other way I can say that I know the directory which contain eof or neof files. But I don't know which type (either eof or neof) files is contained by the directory. How can I achive it by using find command?

PeejAvery
September 28th, 2005, 06:40 AM
Do you speak of searching under sub directories of a website or just hard drive folders?

If you are talking sub directories then it can be done easily with PHP or ASP. You can just do a directory listing and then narrow the list to only folders you want by an "if...then" statement.

If you want hard drive, I am sure it is possible with VBScript.