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

7
LINES

< > BotCompany Repo | #1015318 // makeFileNameUnique

JavaX fragment (include)

static File makeFileNameUnique(File f) {
  File orig = f;
  int n = 0;
  while (f.exists())
    f = new File(dirOfFile(orig), orig.getName() + "." + ++n);
  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: #1015318
Snippet name: makeFileNameUnique
Eternal ID of this version: #1015318/1
Text MD5: 23dc5e1fa6d7ca6b5295d748872cd67f
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-12 22:33:44
Source code size: 171 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 388 / 420
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1016338 - makeFileNameUnique_withExtension (by adding .1, .2, .3...)
#1021040 - numberFileNameNotUsedInDir
#1033396 - makeFileNameUnique_beforeExtension