75lb/renamer

Ability to specify an order for renaming files

tibuurcio opened this issue ยท 7 comments

Hi there! Thanks for this awesome lib ๐Ÿ˜„

I'm trying to prefix files in a folder with indexes but I would like to be able to do it in a specific order, e.g.: in order of size, addition date, etc...

I would be willing to work in such a feature and submit a PR if you think it's a good idea! I believe we could use Node's fs.Stats Class properties to be able to specify an order-by property and do the ordering before mapping over the files array.

What do you think about this?

75lb commented

hi, that sounds like a good idea thanks. Feel free to work on an order-by feature and share the results with me. If the feature benefits other users I may include it in a future release.

@tibuurcio would appreciate a lot this new feature!

75lb commented

Work on this feature is in progress. In the next version you will be able to supply a file list via stdin, giving you full control over the files processed and their order. In this example, input comes from the output of find via sort:

$ find . | sort --reverse | renamer --find one --replace two

For the most precision, you could hand-roll a file containing one filename per line and pipe it into renamer.

$ cat file-list.txt | renamer --find one --replace two
75lb commented

Renamer v1 prerelease is available to test, see here. Does that solve your issue?

Hi @75lb, this solves my issues very well. It's even more robust than my first approach since we can use a file containing filenames. Thank you very much for working on this ๐Ÿ‘

We can close this issue now since it's resolved!

75lb commented

Pleased to hear your issue is resolved. I'll close this ticket once v1 goes live. If there are any other features you are lacking, now would be a good time to speak!

75lb commented

fixed and released in renamer v1.0.0.