Questions tagged [last-modified]
474 questions
174
votes
11 answers
How to find the most recent file in a directory using .NET, and without looping?
I need to find the most recently modified file in a directory.
I know I can loop through every file in a folder and compare File.GetLastWriteTime, but is there a better way to do this without looping?.

Chris Klepeis
- 9,783
- 16
- 83
- 149
103
votes
3 answers
How can I set the last modified time of a file from python?
I have a python script that downloads a file over FTP using ftplib.
My current download code looks just like the example in the ftp lib docs:
ftp.retrbinary('RETR README', open('README', 'wb').write)
Now I have a requirement that the file…

jdeuce
- 1,706
- 3
- 14
- 20
101
votes
6 answers
How to get File Created Date and Modified Date
I have an .NET EXE file .
I want to find the file created date and modified date in C# application. Can do it through reflection or with IO stream?

griffithstratton
- 1,021
- 2
- 7
- 5
99
votes
5 answers
Check last modified date of file in C#
I'm looking to find out a way of seeing when a file was last modified in C#. I have full access to the file.

Candyfloss
- 3,848
- 4
- 31
- 32
84
votes
3 answers
What takes precedence: the ETag or Last-Modified HTTP header?
For two subsequent requests, which of the following two headers is given more weight by browsers should one of them change: ETag or Last-Modified?

user101442
- 2,517
- 3
- 20
- 12
46
votes
2 answers
Which one to use : Expire Header, Last Modified Header or ETags
I am running PHP on Apache, and am confused about how to implement server-side caching, in order to make the site load faster.
What is the difference between the Expires, Last-Modified and ETag headers, and which one should be used in what…

Avinash
- 6,064
- 15
- 62
- 95
36
votes
6 answers
Is there a way to touch() a file in Amazon S3?
I'm currently working with Amazon S3 and I am writing a program that uses the modified dates. I'm looking for a way to edit the modified dates.
I could loop trough all the files and save them as they are, but this sounds like a bad solution.
In PHP…

Ron van der Heijden
- 14,803
- 7
- 58
- 82
34
votes
6 answers
C++ How to check the last modified time of a file
I'm caching some information from a file and I want to be able to check periodically if the file's content has been modified so that I can read the file again to get the new content if needed.
That's why I'm wondering if there is a way to get a…

Mr. Nicky
- 1,519
- 3
- 18
- 34
33
votes
9 answers
How do I find the last modified file in a directory in Java?
How do I find the last modified file in a directory in java?

jumar
- 5,360
- 8
- 46
- 42
26
votes
11 answers
How to check if directory contents has changed with PHP?
I'm writing a photo gallery script in PHP and have a single directory where the user will store their pictures. I'm attempting to set up page caching and have the cache refresh only if the contents of the directory has changed. I thought I could…

PHLAK
- 22,023
- 18
- 49
- 52
25
votes
2 answers
Getting all files modified within a date range
We have a asp.net,C# application in which there is a requirement to get all the files whose date modified will be b/w startdate and enddate . How can we achieve this ?
Also want to get all the files not modified for last 3 months ?
user339160
24
votes
2 answers
Get file modified date in VB.NET
I have a number of files in a folder, and I need to get the last modified date. So I used
FDate = IO.File.GetLastWriteTime(FName)
It works fine with some files, but on others, I get a date of 1/1/1601. But when I check the files in Windows…

Ianb
- 505
- 1
- 3
- 17
22
votes
6 answers
How can I find the newest created file in a directory?
Is there an elegant way in Perl to find the newest file in a directory (newest by modification date)?
What I have so far is searching for the files I need, and for each one get it's modification time, push into an array containing the filename,…

Tom Feiner
- 20,656
- 20
- 48
- 51
22
votes
6 answers
Retrieve file creation or modification date
I'm using this piece of code to try to retrieve the last modified date of a file:
NSError *error = nil;
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath: myFilePath error:&error];
if (attributes != nil) {
…

Robert
- 5,278
- 43
- 65
- 115
22
votes
3 answers
Linux all files of folder modified yesterday
I have modified some files present in various folders in my webroot. This was development environment. Now I have to find all files modified yesterday to migrate to productions.
Is there any way (Linux command) to list only those files modified…

Pawan
- 517
- 1
- 9
- 25