根据文件属性来判断权限


# 模式  字符表示  说明
# 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))

文件属性大家说怎么修改才好呢
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值