`

CopyDirectory to somewhere

 
阅读更多
public void copyDirectory(File srcPath, File dstPath) throws IOException{

if (srcPath.isDirectory()){
if (!dstPath.exists()){
dstPath.mkdir();
}
String files[] = srcPath.list();

for(int i = 0; i < files.length; i++){
copyDirectory(new File(srcPath, files[i]),
new File(dstPath, files[i]));
}
}
else{
if(!srcPath.exists()){
System.out.println("File or directory does not exist.");
System.exit(0);
}
else
{
InputStream in = new FileInputStream(srcPath);
OutputStream out = new FileOutputStream(dstPath);
// 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();
}
}
System.out.println("Directory copied.");
}
分享到:
评论

相关推荐

    protoc-3.18.0-win64.zip

    copy the contents of the 'include' directory somewhere as well, for example into '/usr/local/include/'. Please refer to our official github site for more installation instructions: ...

    Second Copy 2000

    Second Copy is the perfect automatic backup software designed for Windows XP and above including Windows 8.... So, once it is set up you always have a backup of your data somewhere else.

    linux下的snmp测试脚本

    Copy ct directory to any directory you like. % cp -pR $ORGDIR/ct-snmpv2c-ag-X.X $SOMEWHERE/ct-snmpv2c-ag-X.X % chmod -R +w $SOMEWHERE/ct-snmpv2c-ag-X.X 4. Setup ct environment % (enable TN's ipv6...

    VclZip pro v3.10.1

    This was due to a problem where it would be freed automatically if there was a problem with the ArchiveStream when trying to open it as a zip file (possibly corrupt). Best practice is that ...

    BURNINTEST--硬件检测工具

    - Changes to correct a BurnInTest crash problem on some systems. When the disk and standard RAM tests are run for many hours, BurnInTest may have disappeared with no error message. Release 5.3 ...

    repast模型程序

    The code is released under the GNU General Public Licence so you're welcome to use the code however you would like to but please put a reference to me (Nick Malleson) or to this page somewhere....

    apktool documentation

    Run the following commands to migrate your framework directory Apktool will work fine without running these commands, this will just cleanup abandoned files unix - mkdir -p ~/.local/share; mv ~/...

    mscorlib和tlb.zip

    If you downloaded it from somewhere else, please let us now: http://www.dll-files.com/contact.php Installation instructions: Open the zip-file you downloaded from DLL-files.com. Extract the .dll-...

    EhLib5.0.13 最新的ehlib源码

    Remove or copy to other directory files of old version to prevent crossing old and new version of EhLib (Including EhLib.bpl, EhLib.dcp or EhLibXX.bpl, EhLibXX.dcp, EhLibDataDriversXX, ...

    tModLoader.Windows.v0.11.6.2.7z

    You can simply launch the "Terraria_v1.3.5.3.exe" file in the install directory to launch the vanilla Terraria Client. If that file launches tModLoader or you wish to permanently revery to un-modded ...

    EhLib 6.3 Build 6.3.176 Russian version. Full source included.

    Remove or copy to other directory files of old version to prevent crossing old and new version of EhLib (Including EhLib.bpl, EhLib.dcp or EhLibXX.bpl, EhLibXX.dcp, EhLibDataDriversXX, ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    This separates the implementation from the class definition, while still allowing the implementation to be included where necessary. Another use of -inl.h files is for definitions of function ...

    drupal 6.12

    the contents to the same directory where you extracted Drupal into. 2. CREATE THE CONFIGURATION FILE AND GRANT WRITE PERMISSIONS Drupal comes with a default.settings.php file in the sites/default ...

    EhLib 8.0 Build 8.0.023 Pro Edition FullSource for D7-XE8

    Remove or copy to other directory files of old version to prevent crossing old and new version of EhLib (Including EhLib.bpl, EhLib.dcp or EhLibXX.bpl, EhLibXX.dcp, EhLibDataDriversXX, ...

    联想旭日420AXP系统芯片组驱动

    not copied to the &lt;Windows&gt;\INF directory. Refer to Section 4 for more information. ************************************************************ * 4. LIST OF AVAILABLE COMMAND LINE FLAG OPTIONS ...

    EhLib 9.1.024

    Ability to print/preview page header and page footer where you can specify macros for current page, current date, current time and/or static text. Automatically print/preview multiselected area ...

    U盘量产工具

    Copy the imageUSB directory to the Program Files directory. To uninstall imageUSB ===================== Delete the directory to the Program Files directory. Requirements ============ - Operating ...

    Turbo C++ 3.0[DISK]

    runtime, put the following somewhere in your source files: extern void _floatconvert(); #pragma extref _floatconvert This will force inclusion of floating point formats, which may not be linked...

    go系统编程(英文版)

    are fundamental tasks, show you how to define functions in Go, where the defer keyword is mentioned for the first time in this book and continue by discussing the data structures that Go offers using ...

    Turbo C++ 3.00[DISK]

    runtime, put the following somewhere in your source files: extern void _floatconvert(); #pragma extref _floatconvert This will force inclusion of floating point formats, which may not be linked...

Global site tag (gtag.js) - Google Analytics