1

I want the program to automatically delete files.

Function accept(os.remove(" ")) the variable in Loop(for).

import shutil import threading import glob import os

def test():
    threading.Timer(5.0, test).start () # Was checked every 3 
    for  root, dirs, files in os.walk("/mydir"):
         for file in files: 
         print(file)
         os.remove(" ") #delete the file
         print("remove the file")

test()

Community
  • 1
  • 1
hami
  • 11
  • 4

1 Answers1

0

I believe you want to find the real path of that file to remove it, This answer might help. Python cant get full path name of file

Community
  • 1
  • 1
Pavan
  • 108
  • 1
  • 12