RSS

PowerShell – Reverse strings and reverse file names

30 Jul

With PowerShell it is relatively easy to reverse a string:
$str = “gnirtsdesrever”
$str[-1..-($str.length)] -join “”

Some of you might ask: Why would anyone want to do this ? Well, since the start of the year Usenet DMCA takedowns have begun to occur automatically, very quickly and very often. This means many movies and TV series on Usenet / News Groups are being taken offline very quickly.

Counter measures to prevent takedowns by uploaders include:

  • The use of encrypted links to NZB files.
  • The use file names that make it harder to find copyrighted files.

As you can probably guess, some just reverse the file names. The PowerShell script I’ve created will automate reversing the file names for files in the specified folder that match the specified file name filter.

I hope it is useful for you as well.

PS: Someone else on usenet had the same idea as me and created a VBS that will add a right-click menu option to explorer. I’ve added this in the same location as my PowerShell script as well.

Advertisement
 

Tags: , , , , , , ,

5 responses to “PowerShell – Reverse strings and reverse file names

  1. Roy

    March 10, 2014 at 14:16

    I have Xpsp3, powershell installed.. I can’t get this to install.. Hints? This would be so handy! Nowhere does it say that it only works for Win7 or anything, so I assume the only requirement is powershell. Is that correct? What am I doing wrong? I get errors in that script that installs the entries in the Registry.. And yes I am an administrator on my machine.. Ideas?
    -Roy

    Like

     
    • Bjorn Houben

      March 26, 2014 at 12:48

      I’m not sure. You should upgrade now anyways since XP is almost out of support 🙂

      Like

       
  2. Wammus

    May 27, 2014 at 10:36

    Thnx 4 the tip on reversing strings! Since all my files where stored in a single folder I used your tip to make this oneliner:

    Get-ChildItem * | % { $n=($_.basename[-1..-(($_.basename).length)] -join “”)+$_.Extension; Move-item -Path $_.Fullname -Dest $n }

    Like

     
  3. Jesper Mains

    October 9, 2014 at 23:35

    Just the script i was looking for. Thanks 🙂

    Like

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: