Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Need to strip out a text string from file names

$
0
0

Good morning,

I'm new to the forum and would love to become proficient at using Powershell eventually.  However I have come across a pressing issue which was created as a result of a cryptographic virus attack.  In this instance my customer decided to pay the ransom and receive the decryption key.  Even though this decrypted the files, it has added some information to ALL of the actual file names. 

Lets say the addition piece of information is "_xyz123"  and the original file name is "Michael.txt"

The problem I have is that the additional info has been found in different places on the restored files;

Michael.txt_xyz123

Michael_xyz123.txt

_xyz123Michael.txt

As you can see, the file association in some instances is broken and the ability to find familiar documents is affected in the other examples.

Is there a way that Powershell can check ALL of the files on the C:\ drive (including all subfolders) for the string "_xyz123" and then just remove the string without affecting the rest of the original filename?

Anyone's assistance would be greatly appreciated and I look forward to your responses.

Kind regards,  Mike

  

 


Viewing all articles
Browse latest Browse all 8411

Trending Articles