• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting File Date w/o Changing Access Tag

 
Pat Flickner
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're looking at deleting all files on a unix file system that haven't been used in x amount of time. Here's the code we currently use in our jsp:



The problem on unix is, if you touch the files to get the file's load date, it changes the access timestamp for the file. I can't find anything on how to read the timestamp via Java/jsp without changing any of the file's underlying information.

Thanks for your help.

[ March 25, 2007: Message edited by: Pat Flickner ]
[ March 25, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has absoluely nothing to do with JSP. Moved to an appropriate forum.
 
Pat Flickner
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, the code is in my jsp and it didn't occur to me that this might not be a jsp question.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Putting aside the fact that in this day and age you shouldn't be putting any code at all in a JSP, if it isn't about JSP technology, which this clearly is not, it isn't a JSP question.
 
Pat Flickner
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I inherited the code, Bear, and to be quite honest, with the integration project and a myriad of real problems I've had to address, I haven't had the time to correct all past mistakes, although I have corrected quite a few. This one seemed very low priority considering the overhaul we've had to do. So if could you just ease up a teensy bit, I'd really appreciate it. I'm just looking for answers. If this piece of code were within a servlet -- which it will be eventually -- I would still have need of the answer. You will be pleased to know that a rewrite of this project, partly for the reason you very aptly point out.

Thank you for your help.
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pat Flickner:
I can't find anything on how to read the timestamp via Java/jsp without changing any of the file's underlying information.
I would have thought that the lastModified() method just returned the last modified date, without changing anything else. Are you saying that's not the case in Unix?
 
Pat Flickner
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In unix, any time you get info about a file, it changes the access timestamp. I'm not sure if the lastModified() method does that without affecting anything else.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pat Flickner:
I'm not sure if the lastModified() method does that without affecting anything else.


Seems enough enough to test.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic