Abacus IT
asked on
Store file creation attribute in a string array for later use.
I am pulling multiple files from an FTP site, and when the files are local, I am storing them in separate folders with the current date and time stamp. What I need in addition to that is a minor function that will query the files while they are still on the ftp site for their file creation date. I will be using this creation date to rename the files.
I will show some sample code to help me get started.
I will show some sample code to help me get started.
string[] auditnameList = FTP.getFileList("*");
foreach (string auditN in auditnameList)
{
string[] creationDate = File.GetCreationTime(auditN);
}
ASKER
The main reason for the question was because when the files are created on the FTP site, there is a chance that the contents of the files from 2 different days could have the same date when pulled locally. On the site itself I can see the time of the creation, which helps me when I rename them manually. When my code is pulling and extracting these files automatically, it will only get the creation date of right when the files are pulled, which could cause issues when processing these files.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am trying this addition to my code now, and seeing if I can modify it a little to fit some specifications. It seems to work so far, still doing testing.
ASKER
This code will work perfectly for what I need. The only outstanding thing is, you have this written as a loop. So, what I need is to store 2 of the entry details in a variable to be used later then cleared out, then allow your loop to repopulate the variable for the next file name.
I think when File is downloaded locally the CreationTime on FTP is different than on local. You can only refer to local time.
I'm still confused what you're asking here.