find files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
captedgar
Posts: 7
Joined: 22 Oct 2009 18:13

find files

#1 Post by captedgar » 04 Dec 2009 05:42

Hello everyone

I;m new to this forum and also a newbie to programming.
I have the following batch file which i have managed to come upto. find below

set "file=\\servernameA\C$\dferert\tretevf\erwerew\yuyur\gtytr
\testing.txt"
set "answer="
if exist "%file%" (
echo found the file on server servernameA
echo found the file on server servernameA >>"file.log"
set /p "answer=Delete the file? [y/N] :"
)
if /i "%answer%"=="y" del "%file%"

I need to change the functionality of the above script to search a file if the path is not specified. We have 2 drive on about 40 servers, so lets assume we want to search a file that could exist anywhere either in c drive or g drive. could even be in sub folders. the script should find
this file and ask before deleting. please help

Post Reply