Jump to content
Ketarin forum

Remove previous folders


clorophilla
 Share

Recommended Posts

I'm using https://buildbot.orphis.net/ to update my PCSX2 install through Ketarin. I set it to extract its files (from a .7z archive) to a folder on my computer, but since it's a new version i need to remove the previous folder(s) of the same name. In the folder i see this:

-pcsx2-v1.5.0-dev-2525-g846f31851-windows-x86

-pcsx2-v1.5.0-dev-2533-gb374b1bca-windows-x86

-pcsx2-v1.5.0-dev-2534-gada5daf7c-windows-x86

 

Obviously, version 2534 is the most recent, but i can't find how to detect and remove the old versions. Can someone help me with some script to do this on Ketarin?

Link to comment
Share on other sites

Are you saving the file with the original file name? Yo could save them with just the version (since they're all win32 you don't need "-hash-windows-x86"). Saving with just the version number would allow you to skip this issue. If you'd rather do it post-extract then you can use powershell with something like this:

Get-ChildItem $Path | Where{$_.Name -Match "<RegEx Pattern>"} | Remove-Item

This would look something like this in practice:

Get-ChildItem "k:\_ketarin\builds\pcsx2" | Where{$_.Name -Match "pcsx2-v[\d\.]+-dev-\d+-[a-z0-9]+-windows-x86"} | Remove-Item

You could also use something much simpler if you want to trim it down a bit:

Get-ChildItem "k:\_ketarin\builds\pcsx2" | Where{$_.Name -Like "pcsx2-v*"} | Remove-Item

Or if you want to delete all of them but exclude the current build you could use:

Get-ChildItem "k:\_ketarin\builds\pcsx2" | Where{$_.Name -Like "pcsx2-v*"} | Where{$_.Name -NotLike "pcsx2-v{version}*"} | Remove-Item

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.