private void copyFiles(HFile sourceFile, HFile targetFile, int id, boolean move) throws IOException { if (sourceFile.isDirectory()) { if (!targetFile.exists()) targetFile.mkdir(c); /*try { targetFile.setLastModified(sourceFile.lastModified()); } catch (Exception e) { e.printStackTrace(); }*/ ArrayList<String[]> filePaths = sourceFile.listFiles(false); for (String[] filePath : filePaths) { HFile file = new HFile((filePath[0])); HFile destFile = new HFile(targetFile.getPath(), file.getName(), file.isDirectory()); copyFiles(file, destFile, id, move); } } else { long size = sourceFile.length(); InputStream in = sourceFile.getInputStream(); OutputStream out = targetFile.getOutputStream(c); copy(in, out, size, id, sourceFile.getName(), move); /* try { targetFile.setLastModified(sourceFile.lastModified()); } catch (Exception e) { e.printStackTrace(); }*/ if (!targetFile.isSmb()) utils.scanFile(targetFile.getPath(), c); } }