• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to copy an html file to another folder  RSS feed

 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a jfilechooser .




I am getting a

The path is that of an html file .
Now how do i use this to create the same replica of my selected html file in some directory ?
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you gone through the Basic I/O tutorial?
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl , i don't quite understand that if i copy a file object would i be copying the HTML file or just the file object . It is a bit unclear for me . Maybe if you could just answer that what will be copied : Html or File object , my issue will be resolved .
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through the tutorial, and since you said this:
would i be copying the HTML file or just the file object

You need to go through the API for java.io.File and find out what exactly a java.io.File represents. It's in the first line of the File API. (Hint: it does not represent the content of the file)

Any process of copying file content doesn't care whether the file contains HTML or gobbledygook. If on the other hand you want to analyze the HTML in order to save it with some changes or in some other format, then you need an HTML parser for the first step of that.
 
Viktor Kubinec
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For copying files you can use FileUtils class from apache commons io library.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Viktor Kubinec wrote:For copying files you can use FileUtils class from apache commons io library.


Viktor, I'd really like to know why you would want to use a third party library for something that can so easily be done using only the JDK classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!