Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Moving files (urgent)  RSS feed

 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
i have a problem in moving files from one directory to the another in JSP, Say i have some two to three files in a folder "A" and i want move all this files to the another folder "B".How can i do this.
please help me out.
Thanks
Ramkumar.c
 
dagmar timler
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would use java.io.File:
create a File object for each file that you need in folder "A", then use the renameTo(File) method to rename(move) the files into "B" folder. (you have to create File's in folder "B" that corresponds for each File in "A")
Does this help, or do you need more specifics?
 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
Ya i did, but still i am getting a problem , can u give me some more details.This what i did...
<%
java.io.File f1=new java.io.File("F:/test/1.html");
java.io.File f2=new java.io.File("F:/test/2.html");
out.println(f1.renameTo(f2));
%>
please suggest me..
Thanks
Ramkumar.c
Originally posted by dagmar timler:
You would use java.io.File:
create a File object for each file that you need in folder "A", then use the renameTo(File) method to rename(move) the files into "B" folder. (you have to create File's in folder "B" that corresponds for each File in "A")
Does this help, or do you need more specifics?

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!