# 模式 字符表示 说明
# 0477 -r--rwxrwx 所有者仅可读(4),其他及组可读写执行(7)
# 0677 -rw-rwxrwx 所有者仅可读写(6),其他及组可读写执行(7)
# 0444 -r--r--r-- 所有均仅可读(4)
# 0666 -rw-rw-rw- 所有均仅可读写(6)
# 0400 -r-------- 所有者仅可读(4),组及其他无任何权限(0)
# 0600 -rw------- 所有者仅可读写(6),组及其他无任何权限(0)
# 0470 -r--rwx--- 所有者仅可读,组可读写执行,其他则无任何权限
# 0407 -r-----rwx 所有者仅可读,其他可读写执行,组则无任何权限
# 0670 -rw-rwx--- 所有者仅可读写,组可读写执行,其他则无任何权限
# 0607 -rw----rwx 所有者仅可读写,其他可读写执行,组则无任何权限
#######
# 0 = 普通文件。没有设置任何属性。
# 1 = 只读文件。可读写。
# 2 = 隐藏文件。可读写。
# 4 = 系统文件。可读写。
# 16 = 文件夹或目录。只读。
# 32 = 上次备份后已更改的文件。可读写。
# 1024 = 链接或快捷方式。只读。
# 2048 = 压缩文件。只读。
def file_root(root): #根据属性判断文件权限
try:
print root
root=int(root)
#ASP 特殊
if root==0:
return u"%s/普通文件"%(str(root))
elif root==1:
return u"%s/可读写"%(str(root))
elif root==2:
return u"%s/可读写.隐藏文件"%(str(root))
elif root==4:
return u"%s/可读写.系统文件"%(str(root))
elif root==16:
return u"%s/文件夹.只读"%(str(root))
elif root==32:
return u"%s/可读写"%(str(root))
elif root==1024:
return u"%s/快捷方式.只读"%(str(root))
elif root==2048:
return u"%s/压缩文件.只读"%(str(root))
#
if root==477:
return u"0%s/仅可读"%(str(root))
elif root==677:
return u"0%s/仅可读写"%(str(root))
elif root==444:
return u"0%s/仅可读"%(str(root))
elif root==666:
return u"0%s/仅可读写"%(str(root))
elif root==400:
return u"0%s/可读"%(str(root))
elif root==600:
return u"0%s/可读写"%(str(root))
elif root==470:
return u"0%s/仅可读写执行"%(str(root))
elif root==407:
return u"0%s/仅可读"%(str(root))
elif root==670:
return u"0%s/可读写执行"%(str(root))
elif root==607:
return u"0%s/可读写"%(str(root))
return u"0%s/null"%(str(root))
except BaseException, e:
log.logging.debug("except:%s"%(str(e)))
return u"0%s/except"%(str(root))
文件属性大家说怎么修改才好呢