Solved

Copy and Paste folder through Java code

Posted on 2011-02-11
6
762 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
Comment Utility
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
Comment Utility
check this example to copy files!

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

Expert Comment

by:for_yan
Comment Utility

And this is moving folders from t he same source:
http://www.roseindia.net/java/example/java/io/MovingFile.shtml
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 26

Accepted Solution

by:
ksivananth earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

743 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

8 Experts available now in Live!

Get 1:1 Help Now