-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdirectory-permission-search.py
36 lines (34 loc) · 1.07 KB
/
directory-permission-search.py
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
import string
import re
import os
import time
def isWritable(directory):
try:
temp_filename = "idunno"
#count = 0
filename = os.path.join(directory, temp_filename)
while(os.path.exists(filename)):
filename = "{}.{}".format(os.path.join(directory, temp_filename))
#print("filename",filename)
#count = count + 1
f = open(filename,"w")
f.close()
os.remove(filename)
return True
except Exception as e:
#print "{}".format(e)
return False
#x="C:\Users\Atalay\Desktop\New folder\New folder (5)"
#directory = "C:\\Users\\Atalay\\Desktop\\New folder\\New folder (4)\\New folder (2)"
with open("something.txt","w") as nothing:
for dirpath, dirs, files in os.walk("C:\\Users\\aergen\\Desktop\\Yeni klasör (2)"):
x=dirpath.replace('\\','\\\\')
if "olmamalı" in x:
continue
#print(x)
elif (isWritable(x)):
print("ACCESSIBLE!!!")
print(x)
print(len(x)*'-')
nothing.writelines(x+'\n')
#time.sleep(2)