How to copy the whole directory including subdirectories and files in java

i have written the code for copying the directory with subdirectories.but directory is copying .but its subdirectories and files are not copying.please tell me how to solve this problem
import java.io.*;
public class copy
private void copyFile(File src, File dst) throws IOException
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ( (len = in.read(buf)) > 0) {
out.write(buf, 0, len);
in.close();
out.close();
public int copyDirectory(File srcDir, File dstDir) throws IOException
if (srcDir.isDirectory())
if (!dstDir.exists())
dstDir.mkdir();
String[] children = srcDir.list();
int c= children.length;
System.out.println(c);
for (int i = 0; i < children.length; i++) {
copyDirectory(new File(srcDir, children),
new File(dstDir, children[i]));
else {
// This method is implemented in e1071 Copying a File
copyFile(srcDir, dstDir);
return 1;
public static void main(String args[]) throws IOException {
copy c = new copy();
c.copyDirectory(new File("d:/puvvada/sub "),new File("d:/sub"));
c.copyFile(new File("d:/puvvada/sub/auth.html"),new File("d:/sub/auth.html")) ;

It is NOT a ""here's my spec". As simple as it is.
And of course I know help here is free as in other thousands of forums
That is not really the issue.  You have already noted that this is not as simple as you thought.  There have been at least three statements in reponse to your request.  The reasons for these statements are that you are asking for someone to
write a script that is not a simple script.  YOu canwrite a script and post it with questions and your questions will be answered.
I posted before that you cannot copy applications like Office between systems.  They must be installed.  Office and most other applications can g\be installed by Group Policy.  This -is how we normally do this in Windows.  There is normally
no other way to do this for a large number of systems.
For large numbers of arbitrary file we would normally use RoboCopy.  The issues you have had with RoboCopy can be overcome by setting the correct options.  If you are trying to copy Office or other applications you sill likely find that many files
are locked.  This cannot be overcome by any copy method.  This is one of many reasons why we use Installers for applications.
I suggest that you learn the basics of Windows and how it manages applications and files.  Getting the fundamentals clear will help you to understand how to perform basic tasks in a Windows network.
If you really need help with this then you need to step back and explain exactly what is being copied and why.  I can think of no real world scenario where what you are asking for is necessary.  If you can  explain that perhaps we can point
you at a usable solution.
Just keep in mind that you cannot remotely install Office or most applications by copying the files.  This has always been true in  Windows.
¯\_(ツ)_/¯

Similar Messages

  • How can I copy the whole directory of files from PC to iPad?

    How can I copy the whole directory of files from PC to iPad ?

    Get an app that reads PDF's, such as iBooks or GoodReader or Readdle Docs, then use the file transfer part of iTUnes to get those files to your iPad, through iTunes. ( I have no experience with goodreader, but with ReaddleDocs you can move the files, then create folders to put them in to keep them organized)

  • How  to  copy  the  table1selected  records into table 2 in webdynpro java.

    Hi 
           how  to  copy  the  table1selected  records into table 2 in webdynpro java.
    venkat
    Edited by: venkatpvr on Sep 23, 2011 11:53 AM

    Hi Venkat,
    You have 2 Value Nodes one for Table1 and second for Table2.
    Table1 node having one more Value Attribute i.e check Box data type is Boolean. Now you are requirement are select records from Table1 Node and click on One Method that records will moves to Second Table2 Node.
    Create One Method for getting the Records from 1-Table to 2-Table
    CopytoTable2 ()
    In this method you have to write code like this
    If (wdContext.nodeTable1.Checkbox(true))
    If(1. Check the Table1 Value Node Size()>0)
    Get the Table1 records and set to table2 Value node.
    Else
    Please select check box// Error message
    Hope this helps!!
    Regards
    Vijay K

  • Transfer The Whole DVD (Including Menu and Titles)

    I know that Handbrake is the go-to app for most people, but I'm trying to find a way to transfer a TV show DVD that contains several episodes in it without breaking them into several parts.

    The ipad does not support menuing.
    You cannot rip the DVD so its menu system remains intact and play it back on the ipad.
    Only option would be to see if the DVD has one big file on it (basically playback all episodes) and convert that.

  • How to fill the whole screen of my iMac with the photos included in an iDVD project. (iDVD v. 7.1.2)

    How to fill the whole screen of my iMac with the photos I included in an iDVD project. (iDVD v. 7.1.2). I mean, during playing the burned dvd.
    When I do "Enter Full Screen", the slide show fills the screen but the photo itself remains in the middle with a wide black border filling the rest.
    Any cure for this ?

    Hi
    In iDVD Preferences - Turn off - TV-Safe area - and the Photos will fill the full area with just letterboxing or pillars as max.
    Then "Save as a DiskImage" and test this and see if this plays better - before burning DVDs that's not as You want them.
    Bengt W

  • Where can I find appsutil zip (tar) of the whole directory (db side)?

    Hi!
    I'm finishing a documentation for One Click Clone on Apps 11.5.10.x, as I promised a long time ago.
    8(
    All most all is done, frankly is, but I want to add one more feature: automatic cloning to the empty servers! This will be really cool feature for many people!
    For that I need "apsutil.zip" (from 10gR2 64 installation on Windows 2k8 R2) and "appsutil.tar" (from 11gR2 database installation on CentOS Linux 5.x i386). Both versions are needed to make proper testing. But, if I must choose to get only one version then please let me get Linux version.
    @Hsawwan, all,
    Where to get only this directory files (zipped o tarred)? I do not want to install the whole apps just for these files....so in front appreciate to get from this lovely community.
    THX in front,
    Damir Vadas

    Damir,
    1) I wanted DB side appsutil not APPS side one.You will have to copy the appsutil.zip from the application tier node to the database tier node, this is how we get the database appsutil.zip file.
    2) In the meantime, I have downloaded from otn "V15576-01_1of3"-"V15576-01_3of3" zips, where inside DiskX\dbts\stage\ directory are db0-db4.zip files. I have extract them and I think this is it. I got "appsutility" dir with subfolders and files. From memory, looks like a bingo!OK, but this is just the original file, and you have to make sure that the appsutil.zip file is the one which is generated at the application tier node with the same patchset level.
    1) Could you please verify my note that this is OK? Please see my reply above.
    2) This is from 12R1 pack so is this OK for 11gR2 database?Again, see my reply above :)
    Thanks,
    Hussein

  • How to read the whole name of a music title while scrolling down a list of titles? With the new iOs7 Music App there is no more black box showing the entire name!

    How to read the whole name of a music title while scrolling down a list of titles? The old software-app had the function to click for a longer time on a titles beginning letters until a black box revealed the entire name. I miss this function especially for my classical music, because lots of pieces start with similar words. E.g.:
    "Beethoven: Variations On "Ein Mädchen Oder Weibchen", Op. 66 - Var. 1"
    "Beethoven: Variations On "Ein Mädchen Oder Weibchen", Op. 66 - Var. 2"
    Scrolling in a list of title, I can't distinguish the titles, because just the first words are shown followed by: "...".
    That's horrible!

    Or you could include a width to your body style:
    body {
    background-image: url(Logo/sky1.jpg);
    background-position: center center;
    background-attachment: fixed;
    width: 75%;}
    It might work or not depending on your other color scheme.

  • How to transfer the whole address book from one no...

    Dear friend,
    Could you please advise me "how to transfer the whole address book from one nokia to another nokia phone via blue tooth connectivity. (move one by one is not convenience for my hundreds of contact.
    Thank and waiting for advice...
    victor

    If your phones have the built-in "Transfer" (sometimes called "Switch") application, try it.
    Otherwise, depending on the model(s) you can also copy all contacts to/from the memory card, and get them over that way.
    And you can also synchronize both programs to the same service (e.g., Outlook on a Windows PC using Nokia PC Suite).
    And newer versions of Nokia PC Suite can also be used to make a backup of one phone, and then restore to another.
    PC Suite you can find here: http://www.nokia.com/pcsuite

  • How to copy the nwdi stack while the system is down.

    hi all,
    We've got a problem:our NWDI system is down.And we want to copy the whole stack out since we must get the source code there.How can i do this while the system is down?(The system seems not to get up again).
    I have little knowledge about NWDI infrastructure. So if someone give me a solution,points will be awarded.
    Thank you .
    Best regards
    delma

    hi,suresh,
    Thank you for your reply.
    But the situation is much harder.The server is down and seems to be harder to get up, and our basis wants to reinstall the system.
    How can I export the whole stack and reimport into the new installed NWDI environment?Through change request?
    Best regards,
    delma

  • How to keep the whole page open during browsing

    I am trying to work out how to keep the whole page open in Safari i.e. the top most line with the Apple logo, file, edit, view etc. whilst browsing.  What is the setting to achieve this ?  Since installing Yosemite my MBP 2011 with SSD is behaving oddly at times. Where is the "back" when in Support Communities or is going into the history tab the only way ?
    thanks

    When in the ASC pages, my method involves opening separate windows.
    So I can go back to the reference page from where I first visited a thread.
    Also, pages open faster at times into a new window instead of a tab. As
    my setup has a bit more display than necessary, a few extra windows are
    easier than a bunch of tabs in one frame that have no point of reference.
    Plus, if I wish to copy/paste or drag into another window, or access extra
    content for the sake of reference, I have that; & may use another browser.
    For some content, different browsers may be a preference. I'm used to more
    than two, and one of three becomes more dedicated to things like web mail.
    There may be some options in launchpad items, such as they are.
    Mission Control can access other hidden windows. There's a short
    cut for Full Screen that when used again, reverts to previous size.
    Not sure if this gets near your question, but thought I'd put it out here anyway.
    edited

  • How to copy the same address for multiple contacts in Address Book?

    Hi! I got a question, I didn't find an answer for yet.
    How to copy the post address from one contact to another, without manual entering. I mean if I have one contact with already entered post address, can I just copy it someway at once to another contact?
    I don't want cards to merge, I need separate contacts, that may have different phones, e-mails, but the same post address. Please, advise.

    Thanks! yes, this is a solution I'm following now. But I was wondering about the similar way as it is made in Daylite or Contactizer - you create company with name and post address first, and then can create a contact for that company. And company name and post address will appear in contact name.
    I just wonder why such a simple and useful solution isn't available in Address Book as default.
    I know there are many scripts written for Address Book. Maybe there is something for this purpose?

  • How can I convert the volume directory into a single file installer?

    How can I convert the volume directory into a single file installer? I would like to hide all the miscillaneous files that I don't care for and be able to have the installer double click a single file and have it automatically install.

    On the second prompt screen when prompted 'What kind of self-extracting Zip file file do you want to make?'
    Are you choosing the second option (self-extracting Zip file for software installation)?
    I have a word file that I created to help me remember - is there anyway to email it to you?

  • How to highlight the whole row of a particular line item of sale

    How to highlight the whole row of a particular line item of sales order depending on condition?
    Please help its urgent..
    Looking forward your reply.
    Moderator message: please do more research before asking, show what you have done yourself when asking, do not flag posts as "urgent".
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on Aug 9, 2011 9:30 AM

    Any ideas on what would cause this NOT to work? I added this row right after the table is created and populated and it is still not highlighted when I enter the form. The snippet of code that does this is:
    MyTableModel modelS = (MyTableModel)dataModel.get("S");
    jTable1 = new JTable(modelS);
    jTable1.setRowSelectionInterval(0,0);MyTableModel is this:
    class MyTableModel extends DefaultTableModel {
      public MyTableModel(Object[] columnNames, int numRows) {
        super(columnNames, numRows);
      public boolean isCellEditable(int row, int column) {
        if (TableKey == 'S') {
          if (column == 6) {
            return false;
        if (TableKey == 'O') {
          if (column == 0 || column == 4 || column == 5) {
            return false;
        if (TableKey == 'P') {
          return false;
      return true;
    }Can anyone help? Thanks.
    Allyson

  • I am trying to find out how to copy the image on my existing hard drive to my new hard drive before I install it so it will be like I didn't do anything.

    I am trying to find out how to copy the image on my existing hard drive to my new hard drive before I install it so it will be like I didn't do anything. Thanks for the info. on changing it.

    Format is found in the Erase Tab:
    The Disk Image is found on the Restore Tab:

  • How to copy the java concurren program in oracle application

    Hi All
    I am working in oracle Apps R12.
    In AP (Account Analysis Report) is registered as java concurrent Program.
    Now i need to customize this concurrent program and add two new column and two parameter in that.
    Could any one pls provide me the steps that how to copy the Java concurrent,and make a new customized program.
    Whether copying a java concurrent program is same as cp registered as oracle report.
    Thanks & Regards
    Srikkanth

    Hi Sir,
    Thanks for your reply.
    I have find the xml file form data definition and in that they have written Sql query and they have called a Package.
    And the i have also taken the class file from the path as mentioned.
    Now i need to customize this report by adding two parameter and i need to add two new column to display in the rtf.
    Can you pls tell me the steps to copy or how to customize this report.
    Regards
    Srikkanth

Maybe you are looking for

  • Performance problems with XMLTABLE and XMLQUERY involving relational data

    Hello- Is anyone out there using XMLTABLE or XMLQUERY with more than a toy set of data? I am running into serious performance problems tyring to do basic things such as: * Combine records in 10 relational tables into a single table of XMLTYPE records

  • How to create Business Partners (in Person category) from Customer Accounts

    Hi all In ECC 6.0, I am creating Business Partners (Master Tenant w Customer Account) from 'employee' Customer Accounts and the system is defaulting to the 'Organization' category. Does anyone know how to configure it so that Business Partners are cr

  • Mac 16" Color Display M1298 connect to G5 F9455LL ???

    Hi ... Anyone know if a M1298 16" Apple display can be made to work with a G5 F945LL? regular DVI to VGA connectors don't work. Monitor resolution is 832x624 @ 75 hz thanks dean

  • Corrupted backup files

    Hi, I've only had my BlackBerry Curve 9300 for a couple of months and I'm having problems backing up to my computer. The backup always appears to have been successful (i.e. shows the 'Your backup is complete' message) but when I go to look at the bac

  • What tools I need?

    I'm learning j2ee tutorial.It says I must download "ant" (ant's link cannot access now). If I have an IDE like "eclips" or "JBuilder", I still need that "ant"?(What exactly is it?)