Loading Text Files into Oracle Using Creation Date
I've written a loading program that writes text files to our database. The text files are dumped by another system every 2 hours onto on a shared network drive at my work.
Here's the problem though - the files don't have a date/time stamp within them. I've been getting the date for each file from the creation date. That works okay, but when I've written loading programs in the past, I like to move the loaded files into a folder called "Loaded Files". That way, I can quickly see visually how many files I've loaded vs how many have not be loaded.
The problem this time, is that if I were to move the file into another folder, the creation date changes...a lesson I learned when I copied all of the files into a directory on my C: for testing. They all had the same date/time stamp!
My question is, what's the best way to handle this? I don't want to move the files after loading them if it alters their creation date. I mean, what if I have to go back and load one for some reason, the date will be lost forever. I also don't want to write something into the software that has to check a file each time before loading it to the database. Although that may not be a bad idea anyway.
Thoughts?
Re: Loading Text Files into Oracle Using Creation Date
The creation time isn't changing for me.
Code:
Dim theFile As String = "C:\Temp\FileA.txt"
Dim archivedFile As String = "C:\Temp\Archive\FileA.txt"
Dim fileDateTime As DateTime = IO.File.GetCreationTime(theFile)
IO.File.Move(theFile, archivedFile)
Dim archivedFileName As DateTime = IO.File.GetCreationTime(archivedFile)
MessageBox.Show(fileDateTime.Equals(archivedFileName))
If it truly is changing on you then make a call to SetFileTime.
Code:
IO.File.SetCreationTime(archivedFile, fileDateTime)
Re: Loading Text Files into Oracle Using Creation Date
I bet it changes for me because I'm copying the files into another directory. I bet if I moved them (i.e. "CUT"), it would stay static.