I created this utility to delete the files duplicate in one go by keeping the first version found because the dsm only allowed to delete each individual file one by one. I added the possibility to do a dry-run (no deletion) before actually running the real deletion. No body likes to delete the wrong files :)
- From the main menu > click the Storage Analyzer
- Under Report profile > click Create
- In the storage usage report wizard > type in a name for the report and tick Duplicate file candidates.
- Define the frequency and tick generate now.
- Click on the report task, and then click view complete report
- Finally, you should be in the Disk Usage Report|Duplicate File Candidates report a csv download link should be displayed on the right.
- The dsm download link should look like : https://ip:port/dar/duplicates/YYYY-MM-DD_NN-NN-NN/report.html?SynoToken=XXXXXX
Group,Shared Folder,File,Size,Modified time
1,photo,/volume1/photos/album1/1.png,300 Mb,2018-03-27 22:30
1,photo,/root/1.png,300 Mb,2018-01-01 19:00
1,photo,/mnt/1.png,300 Mb,2018-01-01 19:00
It's true, I could have sorted the duplicate files by "shared folder" or "modified time" before deleting, this could be an improvement for later.
Git clone on your Dsm, and build the jar with maven in /root.
Inside the Dsm run the reporting and download the csv in the location of this jar.
- Synology DSM Nas (at least v.5.x)
- Java 8 installed on it
- Have duplicate file reporting enabled like here: https://www.youtube.com/watch?v=nWw4wo61v80
- Duplicate files remover
- Test run possible with -dry_run option
- Compatible with Synology DSM 213j+
java -jar SynoFileDuplicateRemover.jar -csv_file [file.csv] -dry_run
-csv_file: (mandatory) name of csv containing the list of duplicate files generated by the Nas.
-dry_run: (optional) no argument, test run no deletion.
Configure cron task
- Tests with French characters
- Add csv file
- Add screenshots