You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Tyler Barrus (JIRA)" <ji...@apache.org> on 2014/09/29 14:47:34 UTC

[jira] [Comment Edited] (IO-416) FileUtil One-Up FileName

    [ https://issues.apache.org/jira/browse/IO-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151641#comment-14151641 ] 

Tyler Barrus edited comment on IO-416 at 9/29/14 12:46 PM:
-----------------------------------------------------------

Sebb, the reason I went with changing the filename stem  because of the side effect of changing the extension. It could be simplified to something like "filename stem.txt" -> "filename stem - *.txt" if that would be preferable. 

I also thought about having the user be able to define how they would like the change. Perhaps this is really the best overall solution and something I am willing to help with if that is where this method should head.  

I can change the name to nextOneUpFile as that is what was originally suggested unless there is a better naming convention for a util of this type. 

Also, is there a util that lets us know what the max file name length is for a file? If there is, it would be trivial to add the check in to make sure it isn't too long.


was (Author: barrust):
Sebb, the reason I went with changing the filename stem  because of the side effect of changing the extension. It could be simplified to something like "filename stem.txt" -> "filename stem - *.txt" if that would be preferable. 

I also thought about having the user be able to define how they would like the change. Perhaps this is really the best overall solution and something I am willing to help with if that is where this method should head.  

I can change the name to nextOneUpFile as that is what was originally suggested unless there is a better naming convention for a util of this type. 

> FileUtil One-Up FileName
> ------------------------
>
>                 Key: IO-416
>                 URL: https://issues.apache.org/jira/browse/IO-416
>             Project: Commons IO
>          Issue Type: Wish
>          Components: Utilities
>            Reporter: BELUGA BEHR
>            Priority: Minor
>         Attachments: incrementFileName.patch
>
>
> Create a FileNameUtil or FileUtil facility that allows for creating a one-up extension on files that already exist.
> example:
> archive
> +-- file.txt
> +-- file.txt.1
> +-- file.txt.2
> {code}
> File file = FileNameUtils.nextOneUpFile("/archive/file.txt");
> System.out.println(file)
> // output: /archive/file.txt.3
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)