File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Directory copying Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Directory copying" Watch "Directory copying" New topic

Directory copying

ramu taraka

Joined: May 20, 2007
Posts: 11
The requriement of my project is we need to copy the contents of one dir to anthor directory. How we can do this in Java...

Please help me and its very urgent.......
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Moved from SCJP to here begause it's ugent. I guess that once we see an attempt at solving the problem yourself you will likely get some help...

Or you can try our consultancy service

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
marc weber

Joined: Aug 31, 2004
Posts: 11343

Originally posted by ramu taraka:
... Please help me and its very urgent.......

Hope I'm not too late. The answer is Glad I could help.

(Seriously, see what you can do using this class. If you have specific problems, post back with details.)

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689


For copying and deleting whole directories, is there no utility method in the standard API that does this?

Do you have to use FileUtils at Apache Commons or some other third-party solution?

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15094

No, there is no utility method in the standard API to do this.

Have a look at this: The Java Developers Almanac - Copying a Directory

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Or use a non-standard API:

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link:
subject: Directory copying
It's not a secret anymore!