DEV Community

Discussion on: How to build a Simple file cleaner in Python

millebi_41 profile image
Bill Miller • Edited

If I'm reading this correctly, it seems like it will keep the first file it finds and then turf the rest. This may be a "bad thing" if the first file is a temp file and a subsequent file is the "good one". Just an observation, and other than that, it's a great idea!!
To alleviate this problem it may make more sense to have it create a script to delete the duplicate files instead of actually deleting them immediately. That way a user can view the files to be deleted and remove lines that would be a problem. This could be a bad idea too... YMMV :D

kalebu profile image
Jordan Kalebu Author

Well thanks, @bill Miller for mentioning it out,

I think it's a good idea, never considered that fact. but also in fixing the temp issue thing we can try removing the temp folder in all_dirs so that the script to only focus on the real-life on the drive.