LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-11-2007, 09:37 AM   #1
runnerpaul
Member
 
Registered: Mar 2006
Location: Ireland
Distribution: Fedora 5
Posts: 67

Rep: Reputation: 15
Java - getLatest file from a different folder


Anybody know Java? I currently have this line of code:

System.out.println("The latest file in the current directory is " +
getLatest( new File(System.getProperty("user.dir") ) ) + ".");

It tells me what the last modified file in my current directory is. I would like to find out the last modified file i a different directory though. Can anybody tell me how this is done. I presume it involves changing the ("user.dir) but im not sure what it should be changed to. Just putting the path in causes an error.
 
Old 07-13-2007, 02:26 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Replace the whole 'System.getProperty("user.dir")' by the directory name.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
create a folder/file within a folder using perl indu.a Programming 2 03-07-2007 10:09 PM
Can't access folder in Java install goggyturk Linux - Software 2 08-28-2006 11:39 AM
Where to put mysql-connector-java folder dukehazord Linux - General 1 09-10-2004 11:30 AM
how can i default the max folder file size when it create inside a folder antony_csf Linux - Software 1 06-17-2004 02:26 AM
In wich folder do I have to install Java? fedivh Linux - Software 2 02-08-2004 07:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration