Move items larger than a certain size replace dots with spaces and rename using PowerShell

Problem:

When downloading certain files from the internet they come with the following problems: They come in an unnecessary folder, they come with lots of other smaller files you don’t need, the files themselves contain lots of unnecessary ‘.’ in them which we need to replace with spaces and we would like them to match our naming convention using Filebot.

Solution:

I wrote the below script to solve all the above problems, you will just need to download Filebot and edit your naming format, change the file size to what you want and change your paths.

Get-ChildItem F:\Download_Complete -recurse | where-object {$_.length -gt 224288000} | Move-Item -Destination F:\Download_Complete -force

$dir = "F:\Download_Complete"
CD $dir
Get-ChildItem -Recurse |
    Where-Object {$_.Name -match '.'} |
    Rename-Item -NewName {$_.BaseName.replace('.',' ')+$_.Extension}

Get-ChildItem -Path F:\Download_Complete -Recurse -Directory | Remove-Item -Recurse -Force

filebot -rename F:\Download_Complete --format "{n} - {s00e00} - {t}" -non-strict

Leave a Reply

Your email address will not be published. Required fields are marked *