Powershell Filename One-Liners

The following PowerShell commands are one liners to help you easily organise multiple filenames at once.

 

Remove the same part of a filename from many files that match a filetype:

If you have multiple files with the same pattern in the filename for example in the picture below Radiohead – . You can run the following line to remove it and replace.

 

 

Add text to the beginning of the filename:

This command will add text to the beginning of the filename for each specified file type.

 

Clean-Up script which deletes files older than x amount of days:

This script will delete any files that are older then the amount of days you set. This could be run on a task schedule every month to help keep downloaded content low and not taking up disk space for example.

 

Add S00E Random Number to the front of filtered files

This script will add a random episode number to the beginning of a file name for plex special tv shows.