GithubHelp home page GithubHelp logo

kocmana / filerename Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 72 KB

A small tool to rename filenames, especially images from mobile phones from one pattern to another

License: MIT License

Java 100.00%
command-line-tool filename-utils java mobile-phones photo rename-files renamer-utility renaming-files

filerename's People

Contributors

kocmana avatar

Watchers

 avatar

filerename's Issues

Allow to Define Multiple File Rename Tasks

It would be useful to define several file rename tasks to allow to merge two/n file naming patterns to one common pattern in one singular execution.
Picocli allows to repeat composite argument groups (Documentation) that could be used to implement this feature.

Timestamp rule matches filenames too broadly, leading to exceptions caused by unparsable timestamps

Arguments:

-i "IMG_<<TS|yyyyMMdd_HHmmss>>.jpg" -o "<<TS|yyyyMMdd_HHmmss>>.jpg" -p ".\testfiles" -cp

File names matched:

.\testfiles\IMG_20210726_152901.jpg
.\testfiles\IMG_20210726_152902.jpg
.\testfiles\IMG_20210726_152902__01.jpg
.\testfiles\IMG_20210726_152909.jpg
.\testfiles\IMG_20210726_154326.jpg
.\testfiles\IMG_20210726_154330.jpg
.\testfiles\IMG_211946.jpg
.\testfiles\IMG_211948.jpg
.\testfiles\IMG_211951.jpg
.\testfiles\IMG_211954.jpg

Resulting Exception:

21:19:45:923 a.k.f.s.FileRenameTask [ForkJoinPool.commonPool-worker-1] ERROR - Could not finish task with arguments: CommandLineArguments[path=.\testfiles, recursive=false, inputTemplate=IMG_<<TS|yyyyMMdd_HHmmss>>.jpg, outputTemplate=<<TS|yyyyMMdd_HHmmss>>.jpg, dryRun=false, createCopy=true, collisionResolutionStrategy=FAIL]: Text '211946' could not be parsed at index 6

Allow to Define Collision Resolution Strategy

Currently, file rename jobs will fail if the file can't be renamed due to an already existing file with the same name.
Users should be able to define a collision resolution strategy as command line argument for such cases.

Approach:
Add new command line argument -cr --collisionResolution with the arguments FAIL or ENUMERATE

Allow to Define File Handling Strategy

While renaming may be the common goal, copying the files using the new filename may also be a worthwhile option.

Approach:
Add a -s --strategy option with the options COPY and RENAME (default)

Add JavaDoc to TransformationRule interface

Currently, there is no guidance on the impact of the transformation rule methods and their contracts. This should be ammended by adding reasonable javadoc documentation.

Create Wildcard Template for Input Strings

Enumeration and Creation Date Rules require to have a wildcard template for input strings that identifies several files. This could be created as some sort of regex rule <<R|{regex-expression}>> or, probably easier from user perspective using common wildcards * ? as part of the filename.

  • Example Approach 1:
    • -i "image<<R|[0-9]{8}>>.jpg -o "image<<CD>>.JPG"
    • This would also allow to shift parts of the filename between input and output filename
  • Example Approach 2:
    • i "image*.jpg" -o "image<<CD>>.JPG"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.