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

Bad case: rename *.pdf {{f|replace(".","")}} #27

Closed
derekhu opened this issue Jul 23, 2020 · 3 comments
Closed

Bad case: rename *.pdf {{f|replace(".","")}} #27

derekhu opened this issue Jul 23, 2020 · 3 comments
Labels

Comments

@derekhu
Copy link

derekhu commented Jul 23, 2020

As mentioned in :

62af80c#r40840287

Bad cases:

rename  *.pdf   {{f|replace(".", "")}}         // expect:  "abcdefg...pdf" ==> "abcdefg.pdf"

rename *.pdf  {{f|regexReplace("\\d+", "")}}   //  expect:   'abcdefg01234.pdf' ==> "abcdegf.pdf"

// however, we will get "Invalid command". 

Maybe we can fix it in future:-)

@derekhu derekhu added the bug label Jul 23, 2020
@jhotmann
Copy link
Owner

Since the first one has a period in the command, you'll need to specify a file extension. You can do that with .{{ext}} or .pdf

rename *.pdf "{{f|replace('.','')}}.{{ext}}" -s

abcdefg...pdf → abcdefg.pdf
abcdefg01234.pdf → abcdefg01234.pdf

The second command works fine for me

rename *.pdf "{{f|regexReplace('\\d+','')}}" -s

abcdefg...pdf → abcdefg...pdf
abcdefg01234.pdf → abcdefg.pdf

@jhotmann
Copy link
Owner

@derekhu Sorry for the long delay, there's been a lot of life happening these past several months. I have fixed this locally so you no longer have to specify {{ext}}, it will be included in the 7.0.2 release.

@jhotmann
Copy link
Owner

Fixed in 7.0.2

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

No branches or pull requests

2 participants