My dumb ideas: 400,000+ text files

Code:

i = 1
while 1:
    open(f"{str(i)}.txt", "w")
    i += 1

Notes:
A - I would not recommend running this on a actual PC
(POV, uh… it’s smoking)

Edit: Slight issues, can no longer change or run the repl I did this on, as soon as I try it updates, loading all 400,000+ txt files. Deleted the repl so my storage doesn’t get overloaded, code is now above!

import os

# get all files in current directory
files = os.listdir(".")
# iterate through all files
for file in files:
	# if the file is a text file
	if file.endswith(".txt"):
		# remove it
		os.remove(file)
4 Likes

That works lol, time to see if my repl ever lets me edit again (I may or may not have left it running for 3-5 minutes, so yeah)

Edit: After 12 hours or so (overnight), replit seems to have hiddent the files (though they reappear whenever run). Interesting.

2 Likes

A suggestion, Maybe add a delay between the creation of each file. It may stabilize the program, or at least reduce the stress on the server.
Since the original program is broken, try it on a new repl.

1 Like

Lol, yeah. It’s a interesting idea, but that wasn’t really the goal. I just felt like creating the most intensive program possible for absolutely no reason. (I was bored)

3 Likes

Thanks, though I don’t think the duplicate replit I actually ran it on is editable anymore :slight_smile: