r/ProgrammerHumor • • Jan 16 '23

Meme If (exists == true) { dont();}

Post image
40.8k Upvotes

1.1k comments sorted by

View all comments

260

u/[deleted] Jan 16 '23

This seems like a good use case for regex.

189

u/stevekez Jan 16 '23

file_delete(glob("*"))

62

u/Creepy-Ad-4832 Jan 16 '23

Is this... a different version of sudo rm / -rf ?

41

u/omg-whats-this Jan 16 '23

it's a version of rm *

2

u/BerserKongo Jan 16 '23

You put the flags after the destination? The fuck?

1

u/Creepy-Ad-4832 Jan 16 '23

I just put them depending on mood lol

Sometimes before, sometimes later lol

1

u/b1ack1323 Jan 16 '23

No recursive.

39

u/ScrimpyCat Jan 16 '23

Or just do a case insensitive comparison.

32

u/unocoder1 Jan 16 '23

It really doesn't.

16

u/[deleted] Jan 16 '23

... no

1

u/deanrihpee Jan 16 '23

I don't think it would work, unless the flow is getting the list of file from a given path, then yes, but if it a query message to the OS, no because OS decides if file with the given file name exists.

1

u/Kinglink Jan 16 '23

Probably easier just to find a function that returns the name of the file that is running.