#!/usr/bin/env/python
# -*- coding: utf-8 -*-
# @Time : 2018/11/7 16:34
# @Author : ChenAdong
# @Email : aiswell@foxmail.com import os
import logging
import shutil logging.basicConfig(level=logging.WARN) def txt_reader(_path):
f = open(_path, "r")
_type = ""
for line in f.readlines():
if line.split("|")[0] == "tokentype":
tem = line.split("|")[1]
tem = tem.strip()
# tem = int(tem)
if tem == "1.0":
_type = "admin"
elif tem == "2.0":
_type = "c"
elif tem == "3.0":
_type = "a"
else:
logging.warning("%s 未找到tokentype字段" % _path)
logging.debug("%s %s" % (_path, _type))
f.close()
return _path, _type def move_to(from_dir, to_dir):
# tem = from_dir.spilt("/")
# for _file in tem:
# if os.path.isdir(_file):
# pass
# else:
shutil.copyfile(from_dir, "./%s/%s" % (to_dir, from_dir)) if __name__ == "__main__":
for i in os.listdir(os.getcwd()):
try:
if os.path.isfile(i):
_path, _type = txt_reader(i)
# to_dir = "./%s/%s" % (_type, _path)
move_to(_path, _type)
except shutil.Error:
logging.warning("%s 文件被忽略" % _path)

  

最新文章

  1. objccn-图片格式
  2. [JBoss] - 解决URI提交时乱码问题
  3. 使用异步存储提升 Web 应用程序的离线体验
  4. 编写高质量代码--改善python程序的建议(八)
  5. Faster RCNN 运行自己的数据,刚开始正常,后来就报错: Index exceeds matrix dimensions. Error in ori_demo (line 114) boxes_cell{i} = [boxes(:, (1+(i-1)*4):(i*4)), scores(:, i)];
  6. IP地址转换成Long型数字的算法
  7. OSPF_Network-type
  8. hadoop安装与WordCount例子
  9. spring常用的连接池属性文件配置
  10. 开源数据库连接池之Tomcat内置连接池
  11. 486E - LIS of Sequence(LIS)
  12. OpenCV-Python教程(9、使用霍夫变换检测直线)
  13. HDU 2830:Matrix Swapping II(思维)
  14. React渲染问题研究以及Immutable的应用
  15. linux图形和命令界面切换
  16. chgrp命令详解
  17. 未知行数的文字在div中垂直居中
  18. openwrt-rpcd服务ACL配置错误风险分析
  19. linux下给cpu加压
  20. Easyui datagrid加载数据时默认全选的问题

热门文章

  1. Mac 下安装.NET Core 与 CLI
  2. sql字符处理
  3. drools 的一个小demo
  4. [转]magento 2 modes – 每种模式的特点及如何切换(翻译)
  5. ASP.NET编辑与更新数据(非GridView控件实现)
  6. c#关于路径的总结(转)
  7. 第17课-数据库开发及ado.net 聚合函数,模糊查询like,通配符.空值处理.order by排序.分组group by-having.类型转换-cast,Convert.union all; Select 列 into 新表;字符串函数;日期函数
  8. SQL 通配符的使用?三种
  9. git使用基本教程
  10. SqlSession对象之ParameterHandler