473,703 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return File Modified/Create Date

AP
Is there anyway to determine what the modified or create date is for a
file? In my example I am uploading a text file using the following to
select the filename: GetOpenFileName Lib "COMDLG32.D LL". Is there
anyway to point to that file and return the information about the file
properties? Size, date modified, created, etc?

Thanks

Nov 13 '05 #1
9 10596
Yeah, you can get at all the file date/time info via the GetFileTime()
API call, but do you really care if the date modified and the date
created don't match?

The size and date modified are available via the FileLen and
FileDateTime functions built into Access. If those will work for you,
go for it!

If you really do need to know the date created, Last Accessed, and Last
Changed values, then the GetFileTime() API call is what you need to
use. Unless, of course, you're doing a search, since that information
comes back as a part of the FindFirstFile() and FindNextFile() API
calls.

Nov 13 '05 #2
I've used the unsurprisingly named GetFileTime and GetFileSize API functions
for this in the past - but have found them to be not utterly reliable -
particularly across network drives.
Anyone else found this?

"AP" <ap******@thomp songroup.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Is there anyway to determine what the modified or create date is for a
file? In my example I am uploading a text file using the following to
select the filename: GetOpenFileName Lib "COMDLG32.D LL". Is there
anyway to point to that file and return the information about the file
properties? Size, date modified, created, etc?

Thanks

Nov 13 '05 #3
Chuck Grimsby wrote:
but do you really care if the date modified and the date
created don't match?


A lot of the time they won't, in fact the most likley scenario is that
modified is earlier than created date. This is because the create date
will be the date it's copied to your PC while the modified date is
maintained from the original. Unless of course you downloaded the file
from the web or FTP in which case the created date will be the start of
the download and the modified date will be the end of the download so
the only information on dates/times you can gleen from downloaded files
is the time it took to download them and when :-)

This is another reason for zipping files, the files inside the zip file
maintain their modified date, so if you ever wondered why people bother
zipping files that don't compress very well...

--
[OO=00=OO]
Nov 13 '05 #4
I can't say I've ever had "major" problems with the GetFileSize API
call. To be honest, I don't use it a lot though. FileLen is just too
blazingly easy to use! <Grin>

Like you, I have had some problems on some networks with GetFileTime
however. I remember something or another about a 1601 date on
Non-Windows networks (or networked drives) and whether or not a Windows
PC created or last accessed the file. I'm guessing here since I'm not
sure where my notes are on this, but as I recall, the trick was to get
the Last Modified date first, and ignore the dates that were really
bizare from that.
I think that 1601 date had something to do with a Unix or Linux file.
That was a while back however, so I'm not sure if that's still the case
or not.

Nov 13 '05 #5
See my reply to LeighP, which explains some of the weirdness I've seen.
On Windows PCs however, in addition to what you mentioned, I've also
discovered that the file date/times also have to do with the program
that "last accesses" the file. Some programs totally re-write the
file, others make modifications to the file. Think Access and NotePad
here. When you make a change to an Access file, it's modified. In
NotePad, the file saved is a complete new file. There are other
programs that do this as well.

On occasion it's a good idea to save a copy of a Word or Excel file as
a new file in a new location to "clean out" some of those program's
little extras that build up over time, and then copy the file to it's
oiginal location replacing the existing file. In such cases, even
though you "know" the file has been out there since 1998, it's a new
file, so the dates only appear to be weird.

Nov 13 '05 #6
AP
Thanks, the FileDateTime was exactly what I needed.

Nov 13 '05 #7
Chuck Grimsby wrote:
I can't say I've ever had "major" problems with the GetFileSize API
call. To be honest, I don't use it a lot though. FileLen is just too
blazingly easy to use! <Grin>


FileLen returns a long int, useless on files >2GB :-(

--
[OO=00=OO]
Nov 13 '05 #8
On 7 Jun 2005 02:28:07 -0700, "Chuck Grimsby"
<c.*******@worl dnet.att.net> wrote:
See my reply to LeighP, which explains some of the weirdness I've seen.
On Windows PCs however, in addition to what you mentioned, I've also
discovered that the file date/times also have to do with the program
that "last accesses" the file. Some programs totally re-write the
file, others make modifications to the file. Think Access and NotePad
here. When you make a change to an Access file, it's modified. In
NotePad, the file saved is a complete new file. There are other
programs that do this as well.

On occasion it's a good idea to save a copy of a Word or Excel file as
a new file in a new location to "clean out" some of those program's
little extras that build up over time, and then copy the file to it's
oiginal location replacing the existing file. In such cases, even
though you "know" the file has been out there since 1998, it's a new
file, so the dates only appear to be weird.

Hi
Also some of the times you get from the VB routines "flip" an hour
when daylight saving time comes and goes, this was a "feature" of NT
which confused a few file updating schedulers.
David

Nov 13 '05 #9
Indeed. As I mentioned before, I don't do a lot with that code
anymore. Back a few years I wrote a form that scans a volume or
directory and pumps the information into a table. I keep reusing that
form over and over again without having to change it, so I really don't
think about it a lot. If memory serves however, I have the variable
that holds the filesize decared as a Currency type, which kind of gives
you an idea of how old that code is! (Win 3.11 days.)

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2774
by: Jack Ramius | last post by:
Ok..... I'm trying to create a project where my company has to track certain images on our company web site. What we need is the name, date modified and size of the files in a presentable ASP app list format. What I've done was create a database that stores the file location and name. What I need is the asp vbscript code to find the size of the file on the website server.
1
4476
by: Pierre Maricq | last post by:
Hi, I am using Win2000 and Access2000. I need to build build a macro or write a VBA in Access that would screen all files contained in a directory on my C drive (files are structrured DAT files ) and update an Access table with the following information: (1) Filename (variable lenght) (2) Modified File Date/Time
6
2979
by: Mark | last post by:
Using VS.NET 2003 I have one asp.net application where the modified date never changes. I have other solutions (asp.net/desktop) where the modified date does change. This has been going on for several weeks - it claims it wasn't modified for the past month which is certainly false. Any ideas how to get VS.NET to update the last modified date of the solution? Thanks!
0
2565
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a datalist. When the next user selects trys to run the page, the page fails and I get a generic error message from the stack trace. I am assuming that the document properties cannot be read when a file is open, but it worked well in asp. ...
5
2536
by: Steel | last post by:
Hi at all it is the first time that I use PHP and I need only to modify the last modified date of a file I maked a FIRST little script like this: $FileName="myfile.txt"; $Today =strtotime('2006-01-20 00:00:00'); touch($FileName,$Today)
1
1423
by: Vikash | last post by:
Say Im going to create a new class called "master.cs" if i created this file , by default file and author information should be added at the top of the file. Example ------------------------------------------------------------------------- Author :
3
7177
by: RAMohrmann | last post by:
Greetings, I am attempting to view all files in a directory and if those files have not been modified within the last couple days I will remove them. In order to do this I need to look at the file date modied and check the date. I know how to look at each file name and I know how to remove the file. I just can't figure out how to get access to the date last modifed filed. Below is how I intend to access the file names in the directory.
5
2226
by: techusky | last post by:
I made a script that successfully creates a .zip file of all the files in a directory on my web server, but now what I haven't figured out how to do is how to have it automatically deleted when the user successfully downloads it, as otherwise my server would eventually get clogged up with all these zip files. Any help/suggestions? Thanks
0
1068
by: baker_tony | last post by:
Hi, is there any way of getting details (such as last modified/created date/time) of a file located on the web? E.g I'd like to know when the file "http://www.myWebSite.com/ update.txt" was last created/modified. I'm *guessing* I can use CHttpResponse to get some "Last-Modified" value, but I've found it very difficult to get come clear cut code on how to do so.
0
8755
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8667
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9249
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9116
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4428
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.