numsuffix for renameitem broken

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
tiago
Posts: 589
Joined: 14 Feb 2011 21:41

numsuffix for renameitem broken

Post by tiago »

It simply doesn't produce any result no matter what scenario it finds.
Power-hungry user!!!

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: numsuffix for renameitem broken

Post by tiago »

So I left it alone for some minutes, went back and it started working.

:eh:

The only problem is it does this (top is newest; after a series of 4 operations):

Default_01_03.xml
Default_01_02.xml
Default_01_01.xml
Default_01.xml

instead of expected:
Default_04.xml
Default_03.xml
Default_02.xml
Default_01.xml

for a base file "Default.xml".

Pertinent command:
renameitem("Default_01.xml", "$xml", , "_01");

-because renameitem("Default.xml", "$xml", , "_01"); results null.
Power-hungry user!!!

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

Re: numsuffix for renameitem broken

Post by admin »

(Moved to "Tips & Tricks, Questions & Answer" because it is a usage question.)

I'm not sure what you want to achieve, but SC renameitem probably isn't the right way to go. The Help tells me that it is meant to only rename *one* item.

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: numsuffix for renameitem broken

Post by tiago »

Numsuffix seems to not like finding a basename, admin, ie: it demands a first suffix to start appending more on top of it.
Trying
renameitem("Default.xml", "$xml", , "_01");

on $xml = "Default.xml" produces nothing.

So I'm forced to use
renameitem("Default_01.xml", "$xml", , "_01");

which then produces exotic Default_01_01.xml, Default_01_02.xml, Default_01_03.xml... files, when they should be simply
Default_01.xml, Default_02.xml, Default_03.xml.

I see no logical reason to be forced to such behavior.
Power-hungry user!!!

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

Re: numsuffix for renameitem broken

Post by admin »

Works as advertised and makes sense to me.

What do you want to achieve? Input? Output?

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: numsuffix for renameitem broken

Post by tiago »

All due respect, the advertised behavior would be

renameitem("Default.xml", "$xml", , "_01");

producing "Default_01.xml" if target file ($xml) is "...\Default.xml", as there's no remark at all for the described case. Therefore the sequence would be
Default_02.xml
Default_03.xml
Default_04.xml
and so on, if and when required - which is the reason why numsufiix exists. Of course it's assumed that another "Default.xml" will be there when renameitem is executed again.
Power-hungry user!!!

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: numsuffix for renameitem broken

Post by highend »

It makes sense that it should work this way, even if renameitem references the source file as it's destination file
because logically the destination file already exists -> Hence rename the current one.
One of my scripts helped you out? Please donate via Paypal

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

Re: numsuffix for renameitem broken

Post by admin »

I don't agree, but I will add a flag to make it work as desired in this thread.

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: numsuffix for renameitem broken

Post by tiago »

Can't test the change for the time being but... thanks for listening! :beer:
Power-hungry user!!!

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: numsuffix for renameitem broken

Post by highend »

It works as expected with flags = 16...
One of my scripts helped you out? Please donate via Paypal

Post Reply