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

9
LINES

< > BotCompany Repo | #1019315 // makeDirNameUnique_startWithOne (uses .1, .2, ...)

JavaX fragment (include)

static File makeDirNameUnique_startWithOne(File f) {
  File orig = f;
  int n = 1;
  S name = orig.getName();
  f = new File(dirOfFile(orig), name + "." + n);
  while (f.exists())
    f = new File(dirOfFile(orig), name + (++n));
  ret f;
}

Author comment

Began life as a copy of #1016338

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019315
Snippet name: makeDirNameUnique_startWithOne (uses .1, .2, ...)
Eternal ID of this version: #1019315/6
Text MD5: ca97fbcc3b391c0ca61acda40767404b
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-14 13:06:08
Source code size: 247 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 309 / 347
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1020319 - makeDirNameUnique_startWithOne_noDot (uses name1, name2, ...)