Computing.Net > Forums > Programming > c drive search

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

c drive search

Reply to Message Icon

Name: ali1903
Date: February 19, 2007 at 07:07:34 Pacific
OS: server 2003
CPU/Ram: na
Product: hp
Comment:

Hi

I am trying to create a program to do the following

Search a drive for files of a certain type and the pass the file name on to batch file so a vbs script can be execued on them, I have tried this with for file sbut it keeps crashing with recursive folder errors. Does anyone know why this would happen or another way of doing it.


Thanks
Forfiles
echo on
FORFILES -pC:\ -s -v -m*.ppt -c"CMD /c c:\allinonebat.bat @FILE, @PATH, @FSIZE"

Batch file
IF %ERRORLEVEL% NEQ 0 goto end
IF %3 LEQ 10000000 goto end
echo %2\%1 >> "c:\filename.txt"
move %2\%1 g:\IT_TempStorage\Powerpointtestfiles\%1
copy g:\IT_TempStorage\Powerpointtestfiles\%1 c:\temp\657465834639.ppt
IF %ERRORLEVEL% NEQ 0 goto end
cd c:\
cscript c:\final.vbs c:\temp\657465834639.ppt %2\%1
del c:\temp\657465834639.ppt /F
:end



Sponsored Link
Ads by Google

Response Number 1
Name: Shr0Om
Date: February 21, 2007 at 06:06:54 Pacific
Reply:

Try something like this:
(You have to save the code into a .bat file)

::CODE
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%A in ('dir /b /s *.ppt') do (
cscript c:\final.vbs "%%A"
)
::ENDCODE

Or you can make a list of all .ppt files and save it to a txt file which your vb script could load

@echo off
dir /b /s *.ppt >pptfilelist.txt



0

Response Number 2
Name: ali1903
Date: February 28, 2007 at 08:41:26 Pacific
Reply:

Hi

The first one would seem ideal, however when i run the batch file I get an erroraya A not expected at this point?

Cheers

thanks


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Populating a combo box vb... Batch not copying directo...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: c drive search

Batch script to search/copy/replace www.computing.net/answers/programming/batch-script-to-searchcopyreplace/16663.html

VB Folder Search www.computing.net/answers/programming/vb-folder-search/7874.html

Batch File search and delete file www.computing.net/answers/programming/batch-file-search-and-delete-file/16386.html