Hi!
Does anyone know a searchscript to create a javascript file-search.
I want it to be able to search for a specific filename in a folder INCLUDING
its sub-folders.
I know there is a way to search a folder for a file but not its sub-folders, here
is what I got:
function findFile(Npath) {
var fso = new ActiveXObject(" Scripting.FileS ystemObject");
var fold = fso.GetFolder(N path);
FileEnum = new Enumerator(fold .files);
for (; !FileEnum.atEnd (); FileEnum.moveNe xt()) {
document.editor .originfile.val ue += FileEnum.item() .Name;
//When it finds the file I want it to store its path
if(FileEnum.ite m().Name == document.editor .showfile.value )
document.editor .originfile.val ue = FileEnum.item() .Path;
}
}
This function looks through the mainfolder that you give
as parameter but not its sub-folders, when I tried to come
up with a algorithm for going through each subfolder, my
head started to hurt =). Is there a neat way to do it?
Thx
Does anyone know a searchscript to create a javascript file-search.
I want it to be able to search for a specific filename in a folder INCLUDING
its sub-folders.
I know there is a way to search a folder for a file but not its sub-folders, here
is what I got:
function findFile(Npath) {
var fso = new ActiveXObject(" Scripting.FileS ystemObject");
var fold = fso.GetFolder(N path);
FileEnum = new Enumerator(fold .files);
for (; !FileEnum.atEnd (); FileEnum.moveNe xt()) {
document.editor .originfile.val ue += FileEnum.item() .Name;
//When it finds the file I want it to store its path
if(FileEnum.ite m().Name == document.editor .showfile.value )
document.editor .originfile.val ue = FileEnum.item() .Path;
}
}
This function looks through the mainfolder that you give
as parameter but not its sub-folders, when I tried to come
up with a algorithm for going through each subfolder, my
head started to hurt =). Is there a neat way to do it?
Thx
Comment