Dos batch for checking the files in windowsXP

Microsoft Windows xp professional sp2c e...
March 27, 2011 at 12:02:29
Specs: Windows XP, Intel/4GB
Hi Experts
I would like to have a dos script which will looks into folder pathe D:\Test folder for any files. If there is any file in D:\Test then the script should write a out put to a log file in D:\Logs saying that "Files Exist in Test Folder".

Thanks,
Phani Akella


See More: Dos batch for checking the files in windowsXP

Report •

#1
March 27, 2011 at 13:10:03
if exist D:\Test\*.* @echo.Files exist in Test Folder >> D:\log\FileLog.txt


Report •

#2
March 27, 2011 at 15:50:42
1st.. Widnows xp does not have DOS , the Window you see (known as command prompt) is the windows NT command shell interpreter..

I guess this will work
============================================
@echo off
if exist D:\test\yourfilename echo File does exist in test folder >D:\log.txt
if not exist D:\test\yourfilename echo File does not exist
Pause

===============================================

Subhash Chandra.


Report •

#3
March 27, 2011 at 18:11:44
@IVO, >>if exist D:\Test\*.* @echo.Files exist in Test Folder >> D:\log\FileLog.txt

that worked even if there are no files in directory.


Report •

Related Solutions

#4
March 28, 2011 at 04:09:47
@kurumi Thanks for the advice; here the revised version

dir D:\Test  /B /A-D 1>nul 2>&1 && @echo.Files exist in Test Folder >> D:\Log.txt
 

@subhash chandra Thanks for pointing out the note about DOS and NT; I am bored to warn about that over and over.

Report •

#5
March 28, 2011 at 16:07:44
You welcome IVO :)

Yesterday I seen 3 posts with same thing saying they need DOS script :(

Subhash Chandra.


Report •

Ask Question