Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Get last modified date time attribute of ftp file

Posted on by 1,085

hi,

i have the need to download files from ftp and archive them locally. I want to arrange them by their ftp's last modified date time, a new directory for each YYYYMMDD.

I'm trying to read that attribute, but no luck.

That's what im doing, file download works fine but i cannot retrieve modifieddatetime attribute (lastModifiedDateTime variable gets an empty value in the end...):

System.Object               ftpo;

System.Object               ftpResponse;
System.Net.FtpWebRequest    request;
System.IO.Stream            responseStream;
System.Net.FtpWebResponse   response;
utcDateTime                 lastModifiedDateTime;

...

//ftp login operations...

...

request.set_Method("RETR");
request.set_Proxy( System.Net.GlobalProxySelection::GetEmptyWebProxy() );
ftpResponse = request.GetResponse();
response = ftpResponse;
responseStream = response.GetResponseStream();

lastModifiedDateTime = response.get_LastModified();

*This post is locked for comments

  • vv1984 Profile Picture
    vv1984 1,085 on at
    RE: Get last modified date time attribute of ftp file

    Solved: i had to use the MDTM ftp command instead of RETR.

    and then reponse.get_LastModified() method. The return value can be casted into utcDateTime data type.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans