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

sasi vAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
batfile

From novice to tech pro — start learning today.