Create batch file that sees whether file exists and if not exits then process the remaining process

hi, zip file i need to move completely then only i need to copy some files and delete the old txt file and move the new txt file in no 2 code to the destination. so in my below code what i have to add ??

code:

SET /P programName=Enter vehicle program name :

SET ProgramPath=C:\FNASmartServices\REPORTS\BPNO

SET BackupPath=\\ecc9000203\proj\DI_PMTI_SE\PAT\PAT\PATFiles

setlocal EnableDelayedExpansion & time /T
date /T

FOR /R "%ProgramPath%\%programName%\%dateFile%" %%A IN (*.zip) DO (
     COPY "%%~A" "%BackupPath%\%programName%\"
       )

       if(*zip==********************** here code************

dir /a =%BackupPath%\%programName%\ /b > filename1.txt
rem Initialize variables
set OldestDate=999999
set OldestFile=

rem Read each line from list file
for /f "usebackq tokens=*" %%A in ("filename1.txt") do (

    rem Get right 6 characters of file name and arrange in YYMMDD format
    set FileName=%%~nA
    set FileDate=!FileName:~-2!!FileName:~-6,4!

     rem See if this is the oldest file so far, if so save it
    if "!FileDate!" LSS "!OldestDate!" (
        set OldestDate=!FileDate!
        set OldestFile=%%~A
    ))
rem Delete the oldest file
echo Deleting oldest file "%OldestFile%"
del "%BackupPath%\%programName%\%OldestFile%" 
del "filename1.txt"

Open in new window

************** what  i need to add if conditon**********
2.
 
Del "%BackupPath%\PAT BTT Text Files\%programName%\Old\" /Q
echo Old File Removed
Move "%BackupPath%\PAT BTT Text Files\%programName%\New\*.txt" "%BackupPath%\PAT BTT Text Files\%programName%\Old\"

Open in new window

bhavani vAsked:
Who is Participating?
 
Bill PrewConnect With a Mentor Commented:
I can't understand what you are asking based on:

zip file i need to move completely then only i need to copy some files and delete the old txt file and move the new txt file in no 2 code to the destination.

Please try added further explanation and break this down very clearly to what you need help with.  As worded I doubt any experts will know what you want, and won't be able to help as a result.


»bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.