?
Solved

getting the last access date on a file

Posted on 2005-03-03
10
Medium Priority
?
492 Views
Last Modified: 2010-03-31
Does java support getting a last access date on a file?

I have a windows 2000 server that I want to cleanup.

thanks in advance,

Don
0
Comment
Question by:dprice7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 92

Expert Comment

by:objects
ID: 13455129
0
 

Author Comment

by:dprice7
ID: 13455175
Objects,

Does that equal last accessed.
I want to pick up the files that change but also the ones that are just read so I don't accidentally delete those.

thanks in advance,

Don
0
 
LVL 92

Expert Comment

by:objects
ID: 13455193
no it doesn't give last accessed, don't think that information is even stored by the os.
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 30

Expert Comment

by:Mayank S
ID: 13456872
Some OSs do store it :) you'd be surprised to know that Windows does ;-) but anyway, the File class doesn't give that information.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 13456876
>> you'd be surprised to know that Windows does

You can't see it in Windows explorer in the 'Details' view but you can view it if you right-click on the file and view its properties.
0
 
LVL 6

Expert Comment

by:durgaprasad_j
ID: 13458675
hi,
If you are in linux, try stat <filename>, you will get this.
If there are no inbuilt java functions , you can write a simple JNI .
try man 2 stat
      man 2 fstat
Hope this helps
0
 

Author Comment

by:dprice7
ID: 13463834
durgaprasad,

Windows 2000 server
0
 

Author Comment

by:dprice7
ID: 13463839
mayankeagle,

I need to do it with a program.
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 500 total points
ID: 13474000
At least Java API does not support it. Since you are on Windows (which supports telling the last accessed date of a file), I guess you will have to do some research on finding out which DLL would let you know it, and then invoke it through JNI.
0
 
LVL 6

Expert Comment

by:durgaprasad_j
ID: 13474310
hi,
check this. In .net framework, there is a functioned names getLastAccessTime
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryclassgetlastaccesstimetopic.asp

Hope this helps
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question