Results 1 to 3 of 3

Thread: Loading Text Files into Oracle Using Creation Date

  1. #1

    Thread Starter
    Fanatic Member The_Grudge's Avatar
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    836

    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?

  2. #2
    Frenzied Member MattP's Avatar
    Join Date
    Dec 2008
    Location
    WY
    Posts
    1,227

    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)

  3. #3

    Thread Starter
    Fanatic Member The_Grudge's Avatar
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    836

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width