I have a script that needs to rename a file, and can use either Rename or RenameItem. However, it seems that neither one can silently force an overwrite if there is a collision. That's surprising, so maybe I'm missing something.
But if not... please add an option to Rename or RenameItem (or both) to force overwrite w/o prompt.
Thanks
Want option to force overwrite on Rename
-
highend
- Posts: 14994
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Want option to force overwrite on Rename
Trying to give an item the name of an existing one is (at least) dangerous. Just delete it (or better: copy it to a save place before) before you give a different item the old name.
One of my scripts helped you out? Please donate via Paypal
-
Papoulka
- Posts: 455
- Joined: 13 Jul 2013 23:41
Re: Want option to force overwrite on Rename
Rename doesn't seem more dangerous than CopyTo or MoveTo, which can force an overwrite. Just as with those commands it's a matter of convenience - if I can force an overwrite I don't have to check for existence of the unwanted file and delete it. Things can go wrong scripting those steps too (at least in my hands
). 'Overwrite' is a reasonable switch to have on this particular command; if it was already there nobody would object. I suggest it as consistent and occasionally useful improvement.
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Want option to force overwrite on Rename
Entirely reasonable. +1.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
Stef123
Re: Want option to force overwrite on Rename
Corrrect me if I am wrong - couldn't this trigger an endless loop? Depending on your pattern, you overwrite, then a little later your pattern enforces the same name yet again, and yet again .....
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Want option to force overwrite on Rename
usually it wouldn't be technically endless. Because batch renames do not operate on infinite files usually.
Unless you're renaming a.file to a.copy to a.file to a.copy to a.file to a.copy ...
Unless you're renaming a.file to a.copy to a.file to a.copy to a.file to a.copy ...
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
Papoulka
- Posts: 455
- Joined: 13 Jul 2013 23:41
Re: Want option to force overwrite on Rename
No, the system would only perform one rename. It does that now, but you have to answer two confirmation prompts. Today I've answered many sets of those with more to go. I want a flag that will let me skip the confirmation, that's all.Stef123 wrote:Corrrect me if I am wrong - couldn't this trigger an endless loop? Depending on your pattern, you overwrite, then a little later your pattern enforces the same name yet again, and yet again .....
-
Stef123
Re: Want option to force overwrite on Rename
Thanks for filling me in. I had confused things with sequential renames in another tool, where I once received warnings about an endless loop I was about to produce. So anyway, with this out of the way, I also don't see any reasons why XY should not allow the enforcement.
+1
+1
-
admin
- Site Admin
- Posts: 66650
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Want option to force overwrite on Rename
Too dangerous.
The point is that nobody *thinks* of renaming as potentially destroying another file. This is the difference to CopyTo and MoveTo.
The point is that nobody *thinks* of renaming as potentially destroying another file. This is the difference to CopyTo and MoveTo.
FAQ | XY News RSS | XY X
-
PeterH
- Posts: 2830
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Want option to force overwrite on Rename
In general I understand this.admin wrote:Too dangerous.
The point is that nobody *thinks* of renaming as potentially destroying another file. This is the difference to CopyTo and MoveTo.
But: if for a command the user explicitely requests this, he seems to verify that he thinks of the risc?
-
admin
- Site Admin
- Posts: 66650
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Want option to force overwrite on Rename
I was not aware that this was about scripting. OK, added it to SC renameitem.
FAQ | XY News RSS | XY X
-
Papoulka
- Posts: 455
- Joined: 13 Jul 2013 23:41
Re: Want option to force overwrite on Rename
Thank you! I'll be using it as soon as it appears.
XYplorer Beta Club