Java: Move Directory containing files and directories to new path -


I have a directory in which there are some files and subdirectories with more files.

  folder - directory (path - & gt; / home / abc / xyz / folder) - & gt; Abc.txt (file) - & gt; Ax. Zip (file) - & gt; Address (sub directory) - & gt; PWZ.log (file) - & gt; CyZ.xml (file) - & gt; DataLog.7zip  

etc.

What am I trying to do, it takes the entire directory from one path to another, in which all files and subfolders ( And their files).

Or move this "folder" to / home / abc / xyz / folder / home / abc / subdir / folder.

Does Java provide the API to do this function folder directory or do we need to copy the recursive of only every file on this path?

The best method is possibly a recursive method, such as: it is a method that I run into files A temporary folder

  Private Boolean trick (file sourcefile, file destFile) {if (for SourceFile.isDirectory ()). (File File: sourceFile.listFiles) {This step (file, new file (file.getPath (). Substring ("temp" .length () + 1))); }} And {try {files.move (pathGate (sourceFile.getPath ()), path .get (destFile.getPath ()), standardCopyoption.REPLACE_EXISTING); Back true; } Hold (IOException e) {return false; }     }     return false; }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -