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

10
LINES

< > BotCompany Repo | #1009771 // countTillNewFile - create file1.txt, file2.txt etc. (also works for directories)

JavaX fragment (include)

static File countTillNewFile(File base) {
  ret countTillNewFile(base, "");
}

static File countTillNewFile(File base, S suffix) {
  File f;
  long i = 1;
  while ((f = newFile(f2s(base) + i + suffix)).exists()) ++i;
  ret f;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009771
Snippet name: countTillNewFile - create file1.txt, file2.txt etc. (also works for directories)
Eternal ID of this version: #1009771/3
Text MD5: d48c155421b9ee0b6849f9072ff581ca
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-09 04:46:13
Source code size: 236 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 440 / 481
Version history: 2 change(s)
Referenced in: [show references]