Renaming file(s) to modification date

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Renaming file(s) to modification date

Post by TheQwerty »

admin wrote:
TheQwerty wrote:
admin wrote:I expected this one to work:

Code: Select all

rename , "*.<date yymmdd> /e";
but it just replaces the extension. I'd say this is a bug. If the /e switch is present, then * should refer to the whole name (base+extension), right?
I'd agree with that.
I'm not that sure anymore. It's a bit confusing:

Code: Select all

        Old     Pattern         New 
This is how it works now:
        a.jpg   *-<#3>          a-3.jpg
        a.jpg   *-<#3>.png      a-3.png.jpg
        a.jpg   *-<#3> /e       a-3
        a.jpg   *-<#3>.png /e   a-3.png

With the new way, the latter two would change as follows:
        a.jpg   *-<#3> /e       a.jpg-3
        a.jpg   *-<#3>.png /e   a.jpg-3.png
Now what's better?
*shrugs* To be honest I don't really use batch renaming, but after actually reading the help file's description of the switch "The /e switch simply means: drop the original extension," leaves me thinking you should just leave it as is. I think the majority of people are going to want the current behavior even if it is a little confusing. The case presented here is out of the ordinary I'd say, and as such it's acceptable if it cannot be done using only batch rename.


As an aside, I think you should add mention of the /s and /i switches to the Batch Rename dialog.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Renaming file(s) to modification date

Post by jacky »

admin wrote:I'd say this is a bug. If the /e switch is present, then * should refer to the whole name (base+extension), right?
Yeah, I eventually agree with TheQwerty, I think you shouldn't change it. It actually makes more sense to leave it to the base only, /e or not
Proud XYplorer Fanatic

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Re: Renaming file(s) to modification date

Post by Muroph »

you could use a different char to represent the extension when /e is used.
something like this

Code: Select all

        a.jpg   *-<#3> /e         a-3
        a.jpg   *-<#3>.png /e     a-3.png
        a.jpg   *-<#3>.? /e       a-3.jpg
        a.jpg   *-<#3>.?.png /e   a-3.jpg.png
My shared scripts:
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...

admin
Site Admin
Posts: 66075
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Renaming file(s) to modification date

Post by admin »

Muroph wrote:you could use a different char to represent the extension when /e is used.
something like this

Code: Select all

        a.jpg   *-<#3> /e         a-3
        a.jpg   *-<#3>.png /e     a-3.png
        a.jpg   *-<#3>.? /e       a-3.jpg
        a.jpg   *-<#3>.?.png /e   a-3.jpg.png
Cool idea!

Steadyhands
Posts: 24
Joined: 13 Sep 2006 11:47
Location: Brisbane, Australia
Contact:

Re: Renaming file(s) to modification date

Post by Steadyhands »

so does that mean that this should work now?

Code: Select all

rename b, "*.?.<date yymmdd>" /e
didn't work for me in a script.

but

Code: Select all

*.?.<date yymmdd> /e
works from the batch rename command line.

admin
Site Admin
Posts: 66075
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Renaming file(s) to modification date

Post by admin »

Steadyhands wrote:so does that mean that this should work now?

Code: Select all

rename b, "*.?.<date yymmdd>" /e
didn't work for me in a script.

but

Code: Select all

*.?.<date yymmdd> /e
works from the batch rename command line.
Switch /e goes inside the quotes; it's part of the pattern:

Code: Select all

rename "b", "*.?.<date yymmdd> /e";

Post Reply