import os
import sys
import shutil
import csv

def remove(path):
    """ param <path> could either be relative or absolute. """
    if os.path.isfile(path) or os.path.islink(path):
        os.remove(path)  # remove the file
    elif os.path.isdir(path):
        shutil.rmtree(path)  # remove dir and all contains
    else:
        print("not a correct folder: " + path)
        # raise ValueError("file {} is not a file or dir.".format(path))


# file1 = open('folderList.txt', 'r')
# line = file1.readline()
# # print(line.strip())
# folders = line.strip().split(",")
# # print(folders)
folders = sys.argv[1].split(",")

count = 0
for folder in folders:
    print(str(count)+ ": removing folder " + folder.strip())
    remove(folder.strip())
    count = count+1

