aspose file tools*
The moose likes I/O and Streams and the fly likes Retrieving file directories from a text file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Retrieving file directories from a text file." Watch "Retrieving file directories from a text file." New topic
Author

Retrieving file directories from a text file.

James Viviers
Greenhorn

Joined: Jun 25, 2014
Posts: 4
    
    1
Hi everyone! I'm having a hard time with this issue...

Let's say I have a text file and in the text file exists file directories as such:

'assets/picture1.png'
'assets/picture2.png'

And so on...

How would I then read from this text file and then create those files using 'new File()'?

Here is my code:



It does print out those files, but it doesn't create them.

Any help will be appreciated!
James Viviers
Greenhorn

Joined: Jun 25, 2014
Posts: 4
    
    1
Ok, so I've figured out what the problem was and it was something that I totally missed.

I had to literally create the directory and file..

Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2366
    
  50
Thanks for posting the answer.
You may want to also look at using mkdirs () as it will create a complete path of directories as opposed to just a single directory.
James Viviers
Greenhorn

Joined: Jun 25, 2014
Posts: 4
    
    1
Thanks for replying! I will certainly keep that in mind.
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2366
    
  50
And a belated "Welcome to the Ranch".
My first reply was done from my mobile whilst away and I didn't notice it was you first post here.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10522
    
    9

I think figuring out the problem yourself, and taking efforts to share the solution with others, deserves a cow! (<=link, click to find out what ranch cows mean) Moo!


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
James Viviers
Greenhorn

Joined: Jun 25, 2014
Posts: 4
    
    1
Thanks for the cow! You guys really make me feel at home at this forum! Thanks again!
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2366
    
  50
Good to have you here, and remember to keep coming back to look after your cow
 
 
subject: Retrieving file directories from a text file.