# Unelegant mass renaming from a script

**URL:** <https://resource.dopus.com/t/unelegant-mass-renaming-from-a-script/51422>\
**Category:** Help & Support\
**Tags:** script, rename, commands, jscript\
**Created:** [June 21, 2024, 12:46pm UTC](https://resource.dopus.com/t/unelegant-mass-renaming-from-a-script/51422 "2024-06-21T12:46:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartO](https://resource.dopus.com/user_avatar/resource.dopus.com/marto/32/54727_2.png) [@MartO](https://resource.dopus.com/u/MartO)\
**Post date:** [June 21, 2024, 12:46pm UTC](https://resource.dopus.com/t/unelegant-mass-renaming-from-a-script/51422/1 "2024-06-21T12:46:42Z")

</div>

I would like to improve the following situation:

In a script I have a list of hundreds of files that need renaming. Neither the old nor the new names follow any obvious, regular pattern, so I use a lookup table. Currently I add one RENAME line per file to my command and then run it. That works - but is there a faster/more elegant way?

Is it possible to combine a RENAME command run by a script with a traditional Rename Script, ie. a function like OnGetNewName() that is called for every file and could perform the lookup? Would that even be faster?

Also, is there a way to abort a command without using the progress dialog? Something like cmd.Abort()? My script has its own UI and I have disabled the automatic progress dialog by setting noprogress.

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [June 22, 2024, 9:38pm UTC](https://resource.dopus.com/t/unelegant-mass-renaming-from-a-script/51422/2 "2024-06-22T21:38:36Z")

</div>

> [@MartO](#):
>
> That works - but is there a faster/more elegant way?

Are you finding it particularly slow? If not, I wouldn't worry about it or spend time trying to speed it up if it already works.

---

<div class="post-metadata">

**Author:** ![MartO](https://resource.dopus.com/user_avatar/resource.dopus.com/marto/32/54727_2.png) [@MartO](https://resource.dopus.com/u/MartO)\
**Post date:** [June 23, 2024, 5:18pm UTC](https://resource.dopus.com/t/unelegant-mass-renaming-from-a-script/51422/3 "2024-06-23T17:18:33Z")

</div>

Well, it takes a few seconds, which isn't really an issue. I just always try to optimize and _elegantize_ 😉 .

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [June 23, 2024, 5:20pm UTC](https://resource.dopus.com/t/unelegant-mass-renaming-from-a-script/51422/4 "2024-06-23T17:20:53Z")

</div>

Most of that time is probably just the renaming itself, which can't be avoided. 😃
