Created
November 20, 2015 07:08
-
-
Save machuiwen/612fe9ee65100d501b5d to your computer and use it in GitHub Desktop.
Python script to empty trash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
# delete all files and folders in trash box | |
import os | |
import sys | |
os.chdir('/Users/YourUserName/.Trash') | |
if len(sys.argv) >= 2: | |
if sys.argv[1] == '-t' or sys.argv[1] == '-T': | |
os.system("tree ./") | |
elif sys.argv[1] == '-l' or sys.argv[1] == '-L': | |
os.system("ls -al") | |
os.system("rm -rf *") |
that should work
indentation error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#!/usr/local/bin/python
delete all files and folders in trash box
import os
import sys
os.chdir('/Users/YourUserName/.Trash')
if len(sys.argv) >= 2:
if sys.argv[1] == '-t' or sys.argv[1] == '-T':
os.system("tree ./")
elif sys.argv[1] == '-l' or sys.argv[1] == '-L':
os.system("ls -al")
else:
print("Nothing in the bin to delete")
os.system("rm -rf *")