homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


  New Poll  
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » The Archives   » The Big Archives   » File system question

 - UBBFriend: Email this page to someone!    
Author Topic: File system question
iCoach
Geek
Member # 2141

Member Rated:
3
Icon 5 posted September 24, 2003 14:55      Profile for iCoach     Send New Private Message       Edit/Delete Post 
Ok, here goes, with a great admitance of shame, I use VB. It is quick and dirty, and gets the job done.

Basically I am looking to get the time/date stamp from a file. But I need it down to seconds. The current way I am using (FileDateTime) gives it down to the minute. I am trying to read files and discount ones that I have read in the past, unfortunately the system doesn't recognize the past for a full minute. The result is it processes the file until a minute has passed.

I have thought of logging the files back for a minute, then removing them from the list of past files (since then the time stamp would do it for me) but I want to avoid logging them in the software.

Any thoughts?

-Coach

--------------------
Never upset a goalie - getting punched with a blocker is not a pleasant experience - facemask or not.

Posts: 164 | From: Wisconsin | Registered: Apr 2003  |  IP: Logged
Lex
Uber Geek
Member # 835

Member Rated:
5
Icon 1 posted September 24, 2003 16:32      Profile for Lex   Author's Homepage     Send New Private Message       Edit/Delete Post 
I'd assemble an array of filenames and then process them in order. Other than that, I'm not exactly sure what you are trying to accomplish here.

--------------------
Your conviction that there is a monster under the bed would be a mere eccentricity if you weren't so heavily armed and it was your own bed.

Posts: 977 | From: University of Florida | Registered: Jul 2001  |  IP: Logged
unclefungus
Highlie
Member # 2118

Member Rated:
4
Icon 6 posted September 24, 2003 17:20      Profile for unclefungus   Author's Homepage     Send New Private Message       Edit/Delete Post 
you could get quick and dirty by have ing your program fire up a command.com and piping a "dir" command out to a text file, then read the time/date from the file you just created. This is just an idea please dont think I'd ever really do this

--------------------
Professional software should not have dancing paperclips.

Posts: 613 | From: changes, right now it's Jacksonville or Fayetteville | Registered: Apr 2003  |  IP: Logged
csk

Member # 1941

Member Rated:
5
Icon 1 posted September 24, 2003 23:55      Profile for csk     Send New Private Message       Edit/Delete Post 
Hmm, I don't have VB, but I do have VBS (how similar are they?).

In VBS, a quick look at the help shows a File object, which has a DateLastModified property. If worst came to worst, you could try writing a mini VBS script to the file date.

Alternatively, you could make use of the Archive bit on the files. Mark the ones you've read already with the archive bit on. Or the hidden bit, if that's better for you. It's the Attribute property of the aforementioned FileObject in VBS.

--------------------
6 weeks to go!

Posts: 4455 | From: Sydney, Australia | Registered: Jan 2003  |  IP: Logged
quantumfluff
BlabberMouth, a Blabber Odyssey
Member # 450

Member Rated:
5
Icon 1 posted September 25, 2003 05:58      Profile for quantumfluff     Send New Private Message       Edit/Delete Post 
Setting the archive bit might break a backup scheme.
iCouch: what exactly are you trying to accomplish? IMO the right way to read files once and only once is to either keep a log of them or delete them. I can think of serveral ways just working with file timestamps and the current time can fail, depending on what you are trying to do.

Posts: 2902 | From: 5 to 15 meters above sea level | Registered: Jun 2000  |  IP: Logged
iCoach
Geek
Member # 2141

Member Rated:
3
Icon 1 posted September 25, 2003 06:27      Profile for iCoach     Send New Private Message       Edit/Delete Post 
Ok, a little clarification is needed, sorry about the confusion...

Basically multiple files are being written to one directory, say "C:\". The files could be named anything (they aren't sequential). The files are created on (approx.) 3 second intervals. The application reads through the directory every 5 seconds. Currently the software reads the timestamp of the file to determine if it has been read. The problem is that the timestamp is only accurate down to the minute. Unfortunately that means that every file is read over and over again for an entire minute after its creation (1 minute at the worst anyway).

Is there anyway to get a more accurate time stamp or is my only choice to go with some sort of logging?

-Coach

PS. its Coach not Couch.. [Smile]

--------------------
Never upset a goalie - getting punched with a blocker is not a pleasant experience - facemask or not.

Posts: 164 | From: Wisconsin | Registered: Apr 2003  |  IP: Logged
ParodyMan
Newbie Larva
Member # 2065

Rate Member
Icon 1 posted September 25, 2003 09:19      Profile for ParodyMan     Send New Private Message       Edit/Delete Post 
csk mentioned using the FileSystemObject to get there. Here's some sample code:

code:
Dim fso, fileObj
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObj = fso.GetFile("c:\test.txt")

Dim createDate, modDate, accessDate
createDate = fileObj.DateCreated
modDate = fileObj.DateLastModified
accessDate = fileObj.DateLastAccessed

Hope this helps,

Mike Miller
ESG Labs
http://www.esglabs.com/

Posts: 9 | Registered: Mar 2003  |  IP: Logged
iCoach
Geek
Member # 2141

Member Rated:
3
Icon 1 posted September 25, 2003 13:36      Profile for iCoach     Send New Private Message       Edit/Delete Post 
Well it doesn't look like it is possible to get down to the second file stamps, at least not that I have been able to get... Instead I have set it up so that it create a new folder called "archive" and put all the files that I read in there.

Thanks for the input though guys...

-Coach

--------------------
Never upset a goalie - getting punched with a blocker is not a pleasant experience - facemask or not.

Posts: 164 | From: Wisconsin | Registered: Apr 2003  |  IP: Logged
greycat

Member # 945

Member Rated:
5
Icon 1 posted October 10, 2003 16:18      Profile for greycat   Author's Homepage     Send New Private Message       Edit/Delete Post 
Write in C, and use stat() or fstat(). That returns a time_t (actually a set of them), which is accurate to 1 second. If your OS doesn't have Unix semantics, this may not work. I don't program on DOS or Windows, so I don't know how stat() works there.

If the language or toolkit you're writing in doesn't give you full access to your operating system's features, then scrap it! (Throwing away precision on timestamps, when not asked to do so, is atrocious behavior.)

Posts: 1522 | From: Ohio, USA | Registered: Oct 2001  |  IP: Logged
sconzey
Assimilated
Member # 2347

Member Rated:
4
Icon 14 posted October 13, 2003 11:51      Profile for sconzey     Send New Private Message       Edit/Delete Post 
Woo! I agree with you greycat, C on Linux is the way to go... I ditched Windows a couple of months back, and I much prefer the UNIX filesystem commands to the Windows ones...

--------------------
"Violence is the last resort of the incompetent."
--Isaac Asimov

Posts: 490 | From: UK | Registered: Aug 2003  |  IP: Logged


All times are Eastern Time  
  New Poll   Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

© 2015 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam