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

Sebb commented on IO-416:
-------------------------

Thanks for the patch, however it uses a different naming convention from the 
original.
Apart from that, spaces and parentheses are not valid on all filing systems and 
may cause problems with shell scripts.

The original suggestion should work on most (*) filing systems, and is simple 
to implement.
However it has the disadvantage that the extension is changed.
So it may make sense to consider a variant where the filename stem is changed 
instead.
Any additional characters need to be ones that are not likely to cause problems 
with the filing system.
The user could be asked to provide the formatting string, otherwise the scheme 
that is chosen must be suitable for most OSes.

(*) some filing systems do not allow multiple "." in a file name. Or the 
increase in length of the name may cause a problem.

> 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)

Reply via email to