Solved

Copy and Paste folder through Java code

Posted on 2011-02-11
6
782 Views
Last Modified: 2012-05-11
I want to copy folder from one path and paste it to another path through Java code for backup purpose. How to do it. Please help
0
Comment
Question by:Aurii
  • 2
  • 2
  • 2
6 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 34868989
Do you mean you want to move folder from one location to another?
That can be done recursively, traversing the folder and copying the files.



0
 
LVL 26

Expert Comment

by:ksivananth
ID: 34869003
check this example to copy files!

http://www.roseindia.net/java/beginners/CopyFile.shtml
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34869009

And this is moving folders from t he same source:
http://www.roseindia.net/java/example/java/io/MovingFile.shtml
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 26

Accepted Solution

by:
ksivananth earned 500 total points
ID: 34869010
here is the complete example copying entire folder by traversing,

http://www.roseindia.net/java/example/java/io/CopyDirectory.shtml
0
 
LVL 92

Expert Comment

by:objects
ID: 34869364
you can use this code to traverse the directory
http://helpdesk.objects.com.au/java/how-to-recursively-traverse-a-directory-tree

far easier to do it from the command line instead of java though
0
 
LVL 92

Expert Comment

by:objects
ID: 34869384
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now