Jump to content

Get todays Date off a file on a FTP server


Recommended Posts

Hi all

I am kind of new to autoit and requiring some help please.

I need to connect to an FTP server = Sorted

#include <File.au3>

#include <Date.au3>

#include <FTPEx.au3>

$server = '11.11.11.11'

$username = 'YES'

$pass = 'NO'

$Open = _FTP_Open('SessionName')

$Conn = _FTP_Connect($Open, $server, $username, $pass)

I need to get todays date off a file on a FTP server and make sure it's todays date if if is copy the file and then delete it.

;If there is a file - download it

if not @ERROR then

ConsoleWrite("Getting file " & $aFile[10] & @CRLF)

$Ftpp = _Ftp_Fileget($Conn, FTPFileLocation' & $aFile[10], LocalFileLocationA' & $aFile[10])

;Make a copy and rename it to NewFileName

FileCopy("LocalFileLocationA" & $aFile[10], "LocalFileLocationB")

;Copy FileLocation123.txt

FileMove("LocalFileLocationB", "LocalFileLocationC", 1)

;Delete File from FTP

$DelFTP = _FTP_FileDelete($Conn, 'FTPFileLocation' & $aFile[10])

ConsoleWrite("Executing " & "del " & 'FTPFileLocation' & $aFile[10] & @CRLF)

endif

$Ftpc = _FTP_Close($Open)

This part works as well

The part I can't get working is getting the date confirmed as todays date off a FTP server if it is todays date copy the downlaod the file.

Can anyone please help me. :mellow:

Thanks

Link to comment
Share on other sites

you can use the date macros (@Mday, @Mon, @Year depending on the format of the date in the file) and compare them to the date you find in the file

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...