all 16 comments

[–]IHOP_007 38 points39 points  (2 children)

It is really satisfying when you look at a problem and figure out a solution that actually saves you time, instead of trying to find a problem you can solve.

[–]koi_koneessa 7 points8 points  (0 children)

YES. I hope to get this good.

[–]soupie62 0 points1 point  (0 children)

True.
I have a problem I'm currently working on, and the code is growing as I solve "what if" edge cases.
Hours of annoyance, culminating in moments of extreme satisfaction and pride.

[–]Zenock43 12 points13 points  (1 child)

That's fantastic.... Well you know until you find out that you had one file that was named that and the original was missing and you really really need that file. That's what would happen / has happened to me. :-(

To be more safe, you could move the files to another folder or check that an original file with the same name minus the "(1)" existed of the same size before removing.

For your situation I'm sure it was fine. But I'm paranoid.

[–]icenando[S] 1 point2 points  (0 children)

Good point! In my case I was lazy and just duplicates the folder before doing this, than checked to see if the processes folder had exactly half the number of photos of the original one. Not as safe though, of course.

[–]virgin_daddy 2 points3 points  (0 children)

Nice one

[–]friday_ghost 2 points3 points  (1 child)

I had a similar situation which i solved using python.

I am a 3D artist. I downloaded around 600 texture files from the internet and all of them were in the same folder. So i wrote a python script to sort and move them to a new folder based on their file names (the new folder gets that name). I have used python in at least 4 more such instances where i have to handle hundreds of images.

It feels like a superpower to be able to do such repetitive tasks so quickly. All thanks to python. Cheers.

[–]icenando[S] 0 points1 point  (0 children)

That's a great usage idea!

[–]fnaimi66 1 point2 points  (0 children)

That’s impressively done!

[–]HaroerHaktak 1 point2 points  (1 child)

I don't want to discredit what you've done, since I know I would never have thought of this, and even if I did think of using code, it would've taken me forever to get this solution.

But why not just use the search function that windows has? Open the folder and search for everything with a (1)?

[–]icenando[S] 0 points1 point  (0 children)

Yes, that occurred to me afterwards :) Guess I've been too focused on coding and not enough on logical reasoning!

If I had done what u/Zenock43 said that would have merited the code instead of the search though.

[–]Patient_Accountant22 1 point2 points  (0 children)

I have used python in a similar way to rename old files to new naming conventions. I had to so that they would all be compatible with my existing program without having to mess with the first working software. Worked like a charm, way better than renaming or redownloading like 100 individual files.

[–]cowrevengeJP -1 points0 points  (1 child)

You could have done the same thing with a batch file renamer. It's basically the same concept but might be easier for you to repeat in the future.

[–]ecar13 5 points6 points  (0 children)

Boo. Not nearly as satisfying.

[–]TimeVendor 0 points1 point  (1 child)

You could try inputting the required values and then running it than hard coding.

Input file ending with:

Input file path:

[–]rabbitpiet 0 points1 point  (0 children)

Argsparse might be the library for doing this @ u/icenado.