Hello,i use FileWriter to write content into a file, the fileName containspath and file name, however, the path (folder) does not exist:test/test.txt (the folder "test" does not exist yet)new FileWriter(fileName) throws an exception.I don't want to create the folders manually, since there are too manyfolders to be created.thanks!regards,schuen
|
|
0
|
|
|
|
Reply
|
Stefan.Jia (2)
|
4/4/2007 11:18:21 AM |
|
Stefan.Jia@googlemail.com wrote:>Hello,G'day.>i use FileWriter to write content into a file, the fileName contains>path and file name, however, the path (folder) does not exist:>>test/test.txt (the folder "test" does not exist yet)>>new FileWriter(fileName) throws an exception.>>I don't want to create the folders manually, since there are too many>folders to be created.Uh-huh. ..Let us know how that goes, and feel free to pop back by if you have any questions.As a general tip, I strongly recommend usingthe File(File, String) constructor to build deep(or any) paths. Obviously, an easy way to get there is to loop through an array of stringsrepresenting the directory names.This seems to be almost exactly what you do not want to do.>thanks!No worries!(As an aside, every sentence should start with an Upper Case letter. Using caps. at the right places, helps the reader.)-- Andrew Thompsonhttp://www.athompson.info/andrew/Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200704/1
|
|
0
|
|
|
|
Reply
|
Andrew
|
4/4/2007 12:11:57 PM
|
|