Jump to content

Recommended Posts

Posted

The Sims 4 Mod Cleaner (Find, View, and Easily Remove All Duplicate Mods)

View File

S4ModCleaner is a tool comprising a simple PowerShell script using Windows Forms to view and manage duplicates of mods found within a selected folder.

This tool flags files as duplicates via the following criteria:

-The file names AND file sizes match

Examples:

-test.package with file size 12.3MB compared to test.package with file size 8.4MB IS NOT flagged as a duplicate

-test.package with file size 12.3MB compared to test1.package with file size 12.3MB IS NOT flagged as a duplicate

-test.package with file size 8.4MB compared to test.package with file size 8.4MB IS flagged as a duplicate

 

This tool features a comparison tool that allows comparison of currently installed mods with other files/newly downloaded mods to see which files are already installed.

 

The main feature of this tool is the Fix and Fix All functions. Each function removes the duplicates minus the file with the oldest creation time and all duplicates minus the files with the oldest creation times respectively.

 

A filter option present on the Mods Folder Location selection form allows scanning for duplicates of ANY file-type OR .package and .ts4script files only.

 

Please report any suggestions or bugs found.

The desire to quickly find, view, and easily remove duplicate mods resulted in learning PowerShell to create this script. New updates will be released as more is learned.

 

DISCLOSURES

Usage

Creating a backup of the Mods folder is obligatorily recommended before using this tool.

 

Distribution

YOU MAY:

-Modify my work

-Redistribute/Re-upload any modified version under a name other than the original, making it clear that this is not the original version

YOU MAY NOT:

-Redistribute/Re-upload the original version without consent

-Redistribute/Re-upload a modified version under the same name/description of the original work


 

Posted

I made something kinda like this last year. In my version I had one button for searching for duplicates by name, and one button for searching for duplicated by MD5 hash. If purging duplicates was desired, it'd popup a dropdown for selecting which to keep. 

 

I didn't bother distributing it cause I figured no one would trust downloading an executable file. 

Posted

Hi, thanks for your mod.
Sadly, I can't make it work. I tried  both the .bat and powershell way, but I get the same result everytime : A window opens up, with things visibly written up (and from what I managed to catch, an huge bloc of red text, probably en error message) and shuts itself  off half a second afterwards.

Posted
52 minutes ago, Wanelmask said:

Hi, thanks for your mod.
Sadly, I can't make it work. I tried  both the .bat and powershell way, but I get the same result everytime : A window opens up, with things visibly written up (and from what I managed to catch, an huge bloc of red text, probably en error message) and shuts itself  off half a second afterwards.

Same

Posted

You had me excited for a second.

 

But after reading description i fail to see the difference between this and "S4 Tray Importer" or "duplicate finder".

 

 

They all do exactly what yours do.

 

things like "X.package 3MB" and "X(1).package 3,01MB"

 

are the kind of duplicates i need to remove and my folder is full of them, since for some reason modders not only like to steal others work and completely rename it but they also just randomly change the name of the file from XY.package to (AB)XY.package or whatever.

 

An updated CC and its old duplicate with slightly less Bytes needs to be removed too.

 

Is this possible ?

Posted
On 10/14/2024 at 3:29 AM, Wanelmask said:

Hi, thanks for your mod.
Sadly, I can't make it work. I tried  both the .bat and powershell way, but I get the same result everytime : A window opens up, with things visibly written up (and from what I managed to catch, an huge bloc of red text, probably en error message) and shuts itself  off half a second afterwards.

 

On 10/14/2024 at 4:22 AM, ItsInfernal said:

Same

I've update the HELP.txt file to correctly list the name of the script when creating the .bat file. It should be:

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '[SCRIPT LOCATION]\S4ModCleaner_v1.4.2_Public.ps1'"

Posted
On 10/14/2024 at 6:45 AM, Grimmdal said:

You had me excited for a second.

 

But after reading description i fail to see the difference between this and "S4 Tray Importer" or "duplicate finder".

 

 

They all do exactly what yours do.

 

things like "X.package 3MB" and "X(1).package 3,01MB"

 

are the kind of duplicates i need to remove and my folder is full of them, since for some reason modders not only like to steal others work and completely rename it but they also just randomly change the name of the file from XY.package to (AB)XY.package or whatever.

 

An updated CC and its old duplicate with slightly less Bytes needs to be removed too.

 

Is this possible ?

This was a fun way to learn PowerShell and the described functionality would indeed be great. I've barely looked into the composition of .package files and believe it is definitely possible but complicated; certainly beyond my current knowledge. This does however present an excellent challenge.

  • 5 months later...
Posted (edited)

The script lets you sort assets by name (by clicking on the Asset header), but doesn't update what pops up when you double-click a line, so it puts the window into an awkward state...

It probably also doesn't need to be re-scanning the entire folder every time you click FIX for a single file - here's a version that fixes that:

S4ModCleaner_v1.4.2a_Public.zip


It would also be nice if it kept the file you had highlighted when you clicked the single-file FIX button

Edited by clubzfanboy
  • 10 months later...
Posted
On 3/20/2025 at 10:51 PM, clubzfanboy said:

The script lets you sort assets by name (by clicking on the Asset header), but doesn't update what pops up when you double-click a line, so it puts the window into an awkward state...

It probably also doesn't need to be re-scanning the entire folder every time you click FIX for a single file - here's a version that fixes that:

S4ModCleaner_v1.4.2a_Public.zip


It would also be nice if it kept the file you had highlighted when you clicked the single-file FIX button

Appreciate the feedback! I will plan on implementing that logic in an update.

 

I refactored the logic for finding and logging duplicates after further learning. Using a lookup hashtable the completion time is a fraction of the original. It's not a full featured update but I found I only used the script to quickly remove all duplicates after a month or so.
The remaining features and better Windows Forms handling will come eventually.

 

S4ModCleaner_v1.5.1.ps1.zip

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...