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.DLL". Is there
anyway to point to that file and return the information about the file
properties? Size, date modified, created, etc?
Thanks 9 10428
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.
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******@thompsongroup.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.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.DLL". Is there anyway to point to that file and return the information about the file properties? Size, date modified, created, etc?
Thanks
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]
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.
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.
Thanks, the FileDateTime was exactly what I needed.
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]
On 7 Jun 2005 02:28:07 -0700, "Chuck Grimsby"
<c.*******@worldnet.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
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.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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
...
|
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...
|
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...
|
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...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
| |