More script help

Well I am tasked with another project that requires another ftp script. This script needs to log on to an ftp site, look for files that are older than x days, and then delete them. I have a script that does deletion based on dates, but not sure how to use it in this scenario. Here is code for current script:
@echo OFF
setlocal EnableDelayedExpansion

REM Define base for folders, and days to keep old folders
Set BaseDir=C:\FTP_LOGS
set DaysToKeep=30

REM Get todays date (MM/DD/YYYY), convert to julian for age checks
call :jDate jToday %DATE:~-10%

REM Process all Files in the directory, delete if old
for %%A in ("%BaseDir%\*.*") do (
  call :jDate jFile %%~tA
  set /A FileAge = !jToday! - !jFile!
  if !FileAge! GTR %DaysToKeep% (
    echo File:[%%A] is [!FileAge!] days old and would be deleted
    del "%%~A"
  )
)

REM Done
exit /b

REM Subroutine to calculate julian date
:jDate return-variable date-string(MM/DD/YYYY) 
  set DateStr=%~2
  set yy=%DateStr:~6,4%
  set /A mm=1%DateStr:~0,2%-100
  set /A dd=1%DateStr:~3,2%-100
  set /a "yy=10000%yy% %%10000,mm=100%mm% %% 100,dd=100%dd% %% 100"
  set /a %~1=dd-32075+1461*(yy+4800+(mm-14)/12)/4+367*(mm-2-(mm-14)/12*12)/12-3*((yy+4900+(mm-14)/12)/100)/4
  exit /b

Open in new window

What I am trying to accomplish in this:
mdelete 201305*DAI*  <YYYYMM> of current month -2 months 
mdelete 201305*MCL*  <YYYYMM> of current month -2 

Open in new window


Basically look for those two files and based on current month, delete all the ones older than 60 days. I have also attached a screenshot of how the files are actually named. Notice that date in the file name changes.
file-list.png
xzay1967Asked:
Who is Participating?
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.

AlexPaceCommented:
Here is a Robo-FTP sample that deletes files over 30 days old: http://kb.robo-ftp.com/script_library/show/49

It uses the time stamp returned by the remote FTP server to get the date rather than the file name.
0
Bill PrewCommented:
Do the file names on the remote server contain the date stamp in their name, and can that be used for the selection criteria?

Also, will this be run with some regular frequency, be that daily, weekly, monthly, etc?  

~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
Microsoft DOS

From novice to tech pro — start learning today.