PDA

View Full Version : Searching directories via .bat file


VeslaR
09-21-2005, 06:54 AM
Hi there,
I would need help with scripting .bat file. I wanna search the directories for some string - just like normal site search. But the thing, whish is really different is, that searching via .bat file can be much faster. I ve done some work already and it works:

@ECHO OFF
SET hledam=%1
FOR /D %%G in ("d:\somedir\*") DO dir /A:D /B "%%G" >> temp
FIND /I "%hledam%" temp
DEL temp

This batch file works quite great, if i run it from command line. (It only searches subdirectiories one level from the one in .bat dir ("somedir"). And it is fast. 15000 subdirectories in aprox. 2seconds. Thats quit good result, cause it doesnt use any index system, or pre-prepared list of directories.

But if I bind is as site command, and if I try to run to using, lets site "site search XXXX"...i got strange error:
(i switched off the "echo off" command to find the problem)

[R] 200-D:\ioFTPD\system>FIND /I "test" d:\ioFTDP\system\temp
[R] 200-FIND nenˇ n*zvem vnitýnˇho ani vnŘjçˇho pýˇkazu,
[R] 200-spustiteln‚ho programu nebo d*vkov‚ho souboru.

What means in english: FIND is not name of any built-in or addon command, runnable program neither batch file.
(sorry for my Engllish, i am sure that this msg looks completely different in English - but i guess u know what I mean :-)

Thats very strange error,because the FIND command is built-in command of all Windows.


I am using Windows 2003 server and ioFTPD 5-5-6 (i know it is very old, but it works good for me...and why should I change it, if it still works :-)

Thx for any further ideas.

Mouton
09-21-2005, 07:14 AM
I'd say it's somewhere in windows\system32. Find it and use the full path to executables in your batch files. ioFTPD environment variables are not the same as the env. vars of a command prompt.

VeslaR
09-21-2005, 07:39 AM
Ach thank u very much Mounton. It seems, that part of my problem is solved now...it doesnt return error now, but it simple does nothing :)) It seems like tha stdout of find isnt good to ioFTPD...i ll try to solve it with ECHO command (which works).