Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #1020322 // moveFileVerboseIfExists - smarter version of File.renameTo(); asserts success. second argument is a target FILE NAME, not the DIR to put it in

JavaX fragment (include)

static void moveFileVerboseIfExists(File a, File b) {
  if (a == null || b == null) ret;
  if (!fileExists(a)) ret with print(a + " not found, skipping move");
  if (!renameFile(a, b))
    fail("File move failed: " + a + " to " + b);
  print("Moved: " + a + " to " + b);
}

Author comment

Began life as a copy of #1015320

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020322
Snippet name: moveFileVerboseIfExists - smarter version of File.renameTo(); asserts success. second argument is a target FILE NAME, not the DIR to put it in
Eternal ID of this version: #1020322/1
Text MD5: a1cb7865cf91c7c4f33183592ece93cd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-14 13:11:28
Source code size: 278 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 305
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)