Results 1 to 3 of 3
Thread: File path validation in Java
- 10-07-2009, 01:07 PM #1
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
File path validation in Java
I need a help regarding file handling in Java.
I want to create a new file on windows m/c.User provides the dynamic path where we have to create the file.
Path may contains absolute path or relative path or simple file name.
I also want to display custome message if path provided by user is wrong.
Some scenarios listed here -
1) z:\ - wrong drive name it must give error message.
2) c:\NewFile.txt - correct file name with correct path should create a file.
3) c:\Testdata - exisiting folder on drive then should give the error message.
4) c:\TestData123\NewFile.txt -invalid path, folder TestData123 is not exist on drive it should give error message.
Please provide your valuable suggestions.
-Aks
- 10-07-2009, 01:10 PM #2
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
isDirectory() method will not work for invalid/non existing drive like z:\
- 10-07-2009, 04:38 PM #3
Senior Member
- Join Date
- Jun 2008
- Posts
- 339
- Rep Power
- 5
Similar Threads
-
reading file from a path
By new_coder in forum New To JavaReplies: 5Last Post: 08-17-2009, 04:52 AM -
find file with * on the path
By itaipee in forum New To JavaReplies: 7Last Post: 07-08-2009, 08:05 AM -
How to set Image file path
By anil.bharadia in forum AWT / SwingReplies: 1Last Post: 01-28-2009, 09:10 PM -
how can i give a file path to java stream ?
By sheckoo in forum New To JavaReplies: 2Last Post: 11-05-2008, 08:42 AM -
file path
By Arsench in forum New To JavaReplies: 7Last Post: 10-30-2008, 05:39 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks