import os
import time

# count = 1
dirname = './'
dirfiles = os.listdir(dirname)

fullpaths = map(lambda name: os.path.join(dirname, name), dirfiles)

dirs = []
files = []

for file in fullpaths:
    if os.path.isdir(file): dirs.append(file)
    if os.path.isfile(file): files.append(file)

print(list(files))


def listtostr(files):
    filess = ""
    for ele in files:
        filess += ele
    return filess

count = 0

yes = "yes"
while yes != 0:
    try:
        # print(count)
        file_name = files[count]
        # if (count % 2) != 0:
        # count = count + 1
        try:
            
            finish = file_name.replace("-1", "")
            os.rename(file_name, finish)
            count = count + 1
            print("success" + str(count))
            time.sleep(0.3)
        except Exception as ee:
            print(ee)
        # else:
        #     pass
    except Exception as e:
        print(e)
