Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add an option that allows passing a list of files as argument #12

Closed
nightson opened this issue Jul 10, 2021 · 14 comments
Assignees
Labels
enhancement Changes to an existing feature

Comments

@nightson
Copy link

In some cases we need to batch rename some files which don't share any similarities in the file names. It would be a pain in the ass to write a RE to match all of them at the same time. It f2 could take a list of files (directly in the command line or as a list file ) as argument, it would be much easier. Thanks!

@ayoisaiah ayoisaiah self-assigned this Jul 10, 2021
@ayoisaiah ayoisaiah added the enhancement Changes to an existing feature label Jul 10, 2021
@ayoisaiah
Copy link
Owner

@nightson Would specifying the each file name in the regular expression not achieve what you want?

$ f2 -f 'a.jpg|3.png|q.txt'

@nightson
Copy link
Author

nightson commented Jul 28, 2021

@nightson Would specifying the each file name in the regular expression not achieve what you want?

$ f2 -f 'a.jpg|3.png|q.txt'

That would work if you only need to rename a few files. If F2 supports file lists it could be easily integrated with other tools like Candy (an AHK script).

@ayoisaiah
Copy link
Owner

Thanks for the clarification @nightson , I will add this feature very soon

@nightson
Copy link
Author

Thanks for the clarification @nightson , I will add this feature very soon

Cool! Kudos to your hard work!

@ayoisaiah
Copy link
Owner

ayoisaiah commented Jul 29, 2021

@nightson Here's how it currently works:

You create a CSV file like this (the second column is optional)

coverage.out,cover.out
LICENCE,license
README.md,README
f2.exe,f2.msi

And pass it to the csv option:

$ f2 -csv 'input.csv'
+--------------+-----------+--------+
|    INPUT     |  OUTPUT   | STATUS |
+--------------+-----------+--------+
| coverage.out | cover.out | ok     |
| LICENCE      | license   | ok     |
| README.md    | README    | ok     |
| f2.exe       | f2.msi    | ok     |
+--------------+-----------+--------+

You can still use the -f and -r options but they will only operate on the paths in the CSV file.

@nightson
Copy link
Author

@nightson Here's how it currently works:

You create a CSV file like this (the second column is optional)

coverage.out,cover.out
LICENCE,license
README.md,README
f2.exe,f2.msi

And pass it to the csv option:

$ f2 -csv 'input.csv'
+--------------+-----------+--------+
|    INPUT     |  OUTPUT   | STATUS |
+--------------+-----------+--------+
| coverage.out | cover.out | ok     |
| LICENCE      | license   | ok     |
| README.md    | README    | ok     |
| f2.exe       | f2.msi    | ok     |
+--------------+-----------+--------+

You can still use the -f and -r options but they will only operate on the paths in the CSV file.

Cool! Could you also add an option that allows passing the paths directly in the command line?

@ayoisaiah
Copy link
Owner

@nightson How do you mean?

@nightson
Copy link
Author

Something like this
f2 -p path1 path2 path3 -f -r

@ayoisaiah
Copy link
Owner

You can do that already. Add the paths after all options

$ f2 -f -r path1 path2 path3

@nightson
Copy link
Author

Sorry I didn't make myself clear. I meant the paths to the files to rename. F2 only supports directory paths to search for currently if I'm not mistaken.

Like this:
$f2 -f -r -p "C:\1.txt" "C:\2.txt" "C:\3.txt"

@ayoisaiah
Copy link
Owner

ayoisaiah commented Jul 30, 2021

@nightson Ok I understand now. I've adapted the code so that it works with both directories and file paths, so you can use either or both.

$ f2 -f -r path1 path/2/file.txt path3

@nightson
Copy link
Author

@nightson Ok I understand now. I've adapted the code so that it works with both directories and file paths, so you can use either or both.

$ f2 -f -r path1 path/2/file.txt path3

Cool. That's an even better implementation! Thank you!

@ayoisaiah
Copy link
Owner

@nightson Please upgrade to the latest release: https://github.com/ayoisaiah/f2/releases/tag/v1.7.0

@nightson
Copy link
Author

nightson commented Aug 5, 2021

@nightson Please upgrade to the latest release: https://github.com/ayoisaiah/f2/releases/tag/v1.7.0

Works like a charm. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Changes to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants