Libraryless. Click here for Pure Java version (1764L/12K).
svoid copyAllFilesInDirectory_rec_noOverwrite(File src, File dest) ctex { print("Listing " + f2s(src)); for (File f : listFiles(src)) { print("Copying " + f2s(f)); File destFile = newFile(dest, f.getName()); if (fileExists(destFile)) fail("Won't overwrite " + f2s(destFile) + " with contents of " + f2s(f)); if (isSymLink(f)) Files.createLink(fileToPath(destFile), fileToPath(f).toRealPath()); else if (isFile(f)) copyFile(f, destFile); else if (isDirectory(f)) { mkdirs(destFile); copyAllFilesInDirectory_rec_noOverwrite(f, newFile(dest, f.getName())); } } }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024337 |
Snippet name: | copyAllFilesInDirectory_rec_noOverwrite - fails when it is supposed to overwrite a file |
Eternal ID of this version: | #1024337/8 |
Text MD5: | 52692abf8cf322b9bc3790f94f12d72d |
Transpilation MD5: | 7eec6368525b01e59cfea4077bece2c3 |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-04 13:45:42 |
Source code size: | 639 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 267 / 360 |
Version history: | 7 change(s) |
Referenced in: | [show references] |