This is the most meaningful thing this newbie has ever done. Comments are appreciated:
#!/usr/local/bin/python trashcan = "/home/anewby/.trashcan" import os, sys, shutil junk = [] for arg in sys.argv: junk.append(arg) junk = junk[1:] empty = False if "-e" in junk: empty = True junk.remove("-e") if not os.path.exists(trashcan): os.mkdir(trashcan) def trash(junk): for i in junk: toss = trashcan + "/" + i if os.path.exists(toss): if os.path.isdir(toss): shutil.rmtree(toss) if os.path.isfile(toss): os.remove(toss) os.rename(i, toss) def can(): for j in os.listdir(trashcan): if os.path.isdir(j): shutil.rmtree(j) if os.path.isfile(j): os.remove(j) if len(junk) is 0 and empty == False: sys.exit() else: if len(junk) > 0: trash(junk) if empty == True: can() _______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor