• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving file directories from a text file.

 
James Viviers
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2988
59
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying! I will certainly keep that in mind.
 
Tony Docherty
Bartender
Posts: 2988
59
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11165
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
James Viviers
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the cow! You guys really make me feel at home at this forum! Thanks again!
 
Tony Docherty
Bartender
Posts: 2988
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good to have you here, and remember to keep coming back to look after your cow
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic