Computing.Net > Forums > Programming > Check for file date

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Check for file date

Reply to Message Icon

Name: vl
Date: February 15, 2006 at 08:54:40 Pacific
OS: XP
CPU/Ram: t
Product: t
Comment:

I need to create a batch file to check a folder for all the .ftp files. If I don't see a .ftp file within the past two days I need to send out an email.




Sponsored Link
Ads by Google

Response Number 1
Name: CWoodward
Date: February 15, 2006 at 16:21:00 Pacific
Reply:

Hmm....Tricky
Try This:

==FtpFinder.bat==

@ECHO OFF

SET cDate=%DATE:~7,2%

:Start

IF NOT EXIST EndDate.txt GOTO MakeFile

FOR /F "tokens=*" %%D IN (EndDate.txt) DO SET eDate=%%D

IF %cDate% GEQ %eDate% GOTO Email

FOR %%F IN (*.ftp) DO ECHO %%F>FtpFiles.txt

GOTO End

:MakeFile

SET /A eDate=cdate+2

ECHO eDate>EndDate.txt

GOTO Start

:Email

IF NOT EXIST FtpFiles.txt START mailto:YourEmail@YourDomain.com?subject=FTP%%20Files^&body=No%%20.FPT%%20Files%%20Found

:End

----------------

<::Note::>
Since DOS doesnt include a way to send e-mails, you'll still have to click the "Send" button on your "Send Message" screen if no .FTP files were found within 2 days

"If it jams, force it. If it breaks, it needed replacing anyway."
-Murphy's Laws


0

Response Number 2
Name: Mechanix2Go
Date: February 15, 2006 at 23:06:57 Pacific
Reply:

Nothing much to do with DOS, but there ARE command line mailers.

As to the "date math" mess, I'll just read along for now.



If at first you don't succeed, you're about average.

M2


0

Response Number 3
Name: CWoodward
Date: February 16, 2006 at 16:31:29 Pacific
Reply:

Yes, If you aren't able to come to your computer every two days to click send, a third-party e-mail sender is just what you need.

Also, if your going to run this program day after day, you should probably add the lines:

IF EXIST FtpFiles.txt DEL FtpFiles.txt

DEL EndDate.txt

After the line:

IF NOT EXIST FtpFiles.txt START mailto:YourEmail@YourDomain.com?subject=FTP%%20Files^&body=No%%20.FPT%%20Files%%20Found

"If it jams, force it. If it breaks, it needed replacing anyway."
-Murphy's Laws


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Check for file date

Check for file existance on server www.computing.net/answers/programming/check-for-file-existance-on-server/16291.html

Bat file to check for multiple files www.computing.net/answers/programming/bat-file-to-check-for-multiple-files/19129.html

Bat file to check for file with current date www.computing.net/answers/programming/bat-file-to-check-for-file-with-current-date/18823.html