couple of days back an infected computer infected my USB drive with a shortcut virus and. I had lots of software in that USB drive i plugged it in my Linux machine and cleaned a lot of files but what the virus did is it created an .exe file in each folder with that folder's name. Each .exe file is capable of infecting another PC. So me with a lot of time in my hand was trying to make a python script ***that goes to each folder check if a .exe file with that folder name exists delete it and run the function for every sub-folder recursively***. but it is not working here what i made so far

```
    #!/usr/bin/python

from __future__ import print_function
import os
import argparse

def deldir(fol):

    # changing to the directory
    os.chdir(fol)

    #Trivial case delte the virus in the root folder
    cwd = os.getcwd()
    #getting just the name of the folder rather than full path by splitting from "/"
    cwd = str(cwd).split('/')[-1]
    #if any .exe file exists with that name
    if any(str(cwd + '.exe') in s for s in os.listdir('.')):
    # delete that file 
        os.remove(str(cwd + '.exe'))
        print('Deleting virus file')

    #making a list with all the contents in the directory
    dirlist = os.listdir('.')
    print(dirlist)

        #Looping through the directory that we just made a list of its contents
    for i in dirlist:

        #checking if it is a directory or not
        if os.path.isdir(i):
            #changing dir to that directory
            os.chdir(i)
            #getting the current working directory
            cwd = os.getcwd()
            #getting just the name of the folder rather than full path by splitting from "/"
            cwd = str(cwd).split('/')[-1]
            #if any .exe file exists with that name
            if any(str(cwd + '.exe') in s for s in os.listdir('.')):
                # delete that file 
                os.remove(str(cwd + '.exe'))
                print('Deleting virus file', str(cwd + '.exe'))
            #listing filders in current directory
            for j in os.listdir('.'):
                #passing that subdirectory to the function itself if its a folder
                if os.path.isdir(j):
                    deldir(j)
        else:
            print('Not a folder so skipping')

def main():
    #parsing the command line arguments
    parser = argparse.ArgumentParser()
    parser.add_argument("fol", help="Directory to enter")
    args = parser.parse_args()
    #passing the command line argument with the folder path to "deldir" function
    deldir(args.fol)

if __name__ == "__main__":
    main()

```

Please point me to right direction i have no idea what i am doing wrong. ***Thanks for reading***