Patient Rename (and/or Move) button

Files that are temporarily in use (e.g., still downloading, being written to etc.) cannot be renamed until they are no longer in use (closed).

This button script allows you to specify new names for selected files, and they will be automatically renamed as soon as they are no longer in use, or when they finish downloading.

This button supports two kinds of "busy" files:

  • Files that are currently in use (locked) by some program.
  • Files which have a ".part" extension while being downloaded (e.g., test.mp4.part) -- such files are created by the web browsers, download managers, YouTube download tools etc.

1
Step 1: for each selected file you'll be asked for a new name.

2
Step 2: any remaining renames are indicated in a list until they are automatically done.

You can move the file instead of renaming by specifying the destination path instead of a new name.
You can also combine rename and move operations by prepending the destination path (e.g., renaming "test.txt" to "C:\Windows\hello.txt" will combine a move and rename operation).

Please note:

  • The "Pending Renames" dialog must remain open for any pending files to be renamed. Closing it is equivalent to clicking Cancel.
  • The script dialogs currently cannot be minimized which may be inconvenient :slight_smile:
  • Each separate click on the button will create a new instance of the "Pending Rename" dialog.
  • When moving, both forward and back slashes are supported and can even be mixed.
  • When moving, an absolute path must be specified, relative paths are not supported. Drives letters must have a slash after a colon.
  • When moving, and the destination path doesn't exist, the move operation will be in a pending state until the destination path becomes available.
  • Quirk: when renaming and the new name is not valid (e.g., contains illegal characters), the operation will remain in a pending state rather than showing the error message. You'll need to click Cancel.

Download this button:
v1.0 (latest) 2023-06-09
Patient Rename.dcf (12.3 KB)
New in this version:

  • Fixed a bug where pressing Cancel causes Opus to use lots of CPU due to runaway loop due to not checking an appropriate event object property.
  • Implemented ability to move the files.
Old version
  • v0.9 2022-12-29
    Not recommended due to a bug causing high Opus CPU usage if the Cancel is clicked or "Pending Rename" dialog closed. Patient Rename.dcf (10.9 KB)

Some extra details on how it works

The script tries to rename the files immediately, and if it fails, it will create a "Pending Rename" dialog with a status list and retry every second. Once a file is renamed it is removed from the list, and once all files are renamed the status dialog closes.
If a file no longer exists, the script will give up on it.
If a file has a ".part" extension, the script will wait until it no longer has a ".part" extension before making a rename attempt.

6 Likes

This tool is fantastic, thanks for making it. I wish there was a way to have a "patient move" so that I could move files to another folder that are in use, and have DO take care of the move when the file is no longer in use.

1 Like

A new version v1.0 is now available (the original post has been updated with more info and the download link).

The new version has the same interface but it supports 3 use-cases now:

  • Rename (just like the previous v0.9 version)
  • Move (instead of a new name you can specify a destination path and the file will be moved there)
  • Move + Rename (you can enter a destination path and a new file name)

Also the version 0.9 had a nasty bug where if you closed/canceled the Pending Rename dialog, the Opus CPU usage would become high (until Opus restart) due to a stuck loop. This has now been fixed.

Note:

  • When moving, both forward and back slashes are supported and can even be mixed.
  • When moving, an absolute path must be specified, relative paths are not supported. Drives letters must have a slash after a colon.
  • When moving, and the destination path doesn't exist, the move operation will be in a pending state until the destination path becomes available.

Stay tuned for any bugfixes...

2 Likes