zoukankan      html  css  js  c++  java
  • python拷贝目录下的文件

    #!/usr/bin/env python
    # Version = 3.5.2
    
    import shutil
    
    base_dir = '/data/media/'
    file = '/backup/tempimages/courseid.txt'
    log = '/backup/tempimages/copy.log'
    with open(file) as f:
        for item in f:
            try:
                srcDir = base_dir+item.strip()[:12]+'/'+item.strip()[12:]+'/images/'
                dstDir = "/backup/tempimages/media/"+item.strip()[:12]+'/'+item.strip()[12:]+'/images/'
                shutil.copytree(srcDir, dstDir)
                with open(log,'a') as l:
                    l.write('---DONE---'+item.strip()[:12]+'/'+item.strip()[12:]+'
    ')
            except Exception as err:
                print(err)
    
    
    
    [root@web-25 tempimages]# more courseid.txt
    20080000620204
    20170092133801
    20100000763203
    20090000670301
    20070000273305
    20070000273304
    20070000273301
    20070000273303
    20070000273302
    

      

  • 相关阅读:
    index()方法
    extend()方法
    count()方法
    copy()方法
    clear()方法
    append()方法
    IE botton 点击文字下沉
    IE滚动条
    关闭windows10自动更新
    vue文件名规范
  • 原文地址:https://www.cnblogs.com/wumingxiaoyao/p/8194558.html
Copyright © 2011-2022 走看看