Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. # import modules
  2. import os, shutil
  3.  
  4. # define a function to remove the files
  5. def clear_trash():
  6.  
  7. # define folder
  8. folder = '/home/user/.local/share/Trash/files'
  9.  
  10. # setup a for lopp to remove the files
  11. for the_file in os.listdir(folder):
  12. file_path = os.path.join(folder, the_file)
  13. try:
  14. if os.path.isfile(file_path):
  15. os.unlink(file_path)
  16.  
  17. clear_trash()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement