summaryrefslogtreecommitdiff
path: root/frontend/im/OLD/clearthedirectories
blob: 6d5b2a74d31c16ad8f27185f3f3e2315003a188d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python2.7

import sys
import os
import time

f = open("directories",'r')
lines = f.readlines()
f.close()
newlines = []
for line in lines:
	if "\n" in line:
		jerry = line.replace("\n","")
		if len(jerry) == 2:
			newlines.append(jerry)
dirs = newlines
print dirs
for dir in dirs:
	print dir
	if len(dir) == 2:
		delete = False
		os.system("ls "+dir+"/ >> contents")
		f = open("contents","r")
		thecontents = f.readlines()
		f.close()
		print thecontents
		os.system("rm contents")
		tempbool = False
 		tempbool2 = False
		if len(thecontents) != 0:
			for x in thecontents:
				if ".jpg" in x:
					tempbool = True
#			if len(thedirs)>40:
#				tempbool2 = True
			if tempbool == True:# and tempbool2 == True:
				print "deleting contents.."
		print "moving to directory '"+dir+"'"
	if len(thecontents)>0:
		x = input("bout to do some deleting 1=yes 0=no")
		if x == 1:
			print "ok deleting "+dir+"/*"
			try:
				os.system("rm "+dir+"/*")
			except:
				continue
		else:
			sys.exit()
	else:
		print "nothing there"
		continue