bulk rename special

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
davemargerum
Posts: 2
Joined: 08 Nov 2018 20:51

bulk rename special

Post by davemargerum »

We recently had some of our files encrypted by ransomware. When they encrypted the files, they accidentaly added a . to the end of each file. In order for the decryptor to work , the trailing period needs to be removed. I have been able to use rename special, and edit items name to remove the trailing period. Is there a way to do this in bulk. There are approx 350,000 files in many folders and subdirectories that need the trailing period removed. Any ideas how to do this, or if it's possible?


Thanks

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: bulk rename special

Post by highend »

You could use XYs normal search (Ctrl + f), switch the "Mode" to RegExp
and use this pattern in the "Name" field:

Code: Select all

\.\.[^.]+$
Additionally, switch to the Attributes tab and check the Not field (the left one) for
Directory (because you only want to find files, not folders)
Use the "Find Now" button and select all found files in the search pane afterwards

And now run this script:

Code: Select all

    setting "BackgroundFileOps", 0;
    $files = <get "SelectedItemsPathNames" <crlf>>;
    foreach($file, $files, <crlf>, "e") {
        renameitem(trim(gpc($file, "base"), ".", "R") . "." . gpc($file, "ext"), $file);
    }
This will take a (long) time on so many files...

And ofc, you should test this on a few sample files first!
One of my scripts helped you out? Please donate via Paypal

davemargerum
Posts: 2
Joined: 08 Nov 2018 20:51

Re: bulk rename special

Post by davemargerum »

thanks for your help. Here's a bit more specifics. All the files were appended with the following extension .[divinehelp235@airmail.cc].
for example: desktop.ini was renamed to desktop.ini.[divinehelp235@airmail.cc].
Once the trailing period is removed desktop.ini.[divinehelp235@airmail.cc] the decrypter works for me


Thanks for your help

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: bulk rename special

Post by highend »

XY seems to refuse to rename such a file via scripting...

Try this (no guaranties!) instead
Traling dot renamer.zip
(49.61 KiB) Downloaded 69 times
Extract it, start it with admin permissions!, point it to a folder or drive (for testing purposes, I'd use a folder)

What does it do? Scans the folder / drive recursively ONLY for files and looks for those that have a trailing dot
Those are forcefully! renamed to one without that dot. Failed to rename file names are stored in a log file (called "Failed.txt") in
the same folder as the .exe...
One of my scripts helped you out? Please donate via Paypal

Post Reply