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)

1  
static File countTillNewFile(File base) {
2  
  ret countTillNewFile(base, "");
3  
}
4  
5  
static File countTillNewFile(File base, S suffix) {
6  
  File f;
7  
  long i = 1;
8  
  while ((f = newFile(f2s(base) + i + suffix)).exists()) ++i;
9  
  ret f;
10  
}

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: 441 / 483
Version history: 2 change(s)
Referenced in: [show references]