@echo off for /r %%a in (*.txt) do copy %%a D:\1 pause 1.for /r主要用于搜索指定路径及其所有子目录中符合要求的文件(/r后如果没有指定目录,则使用当前目录) 2.上述例子实现将脚本所在目录下后缀为txt的文件复制到目录D:\1中 3.批处理当中的 for 循环的结构:for in do. %%a 为变量,/r 为递归方式,in 与 do 之间一定要有 (). for 循环的工作流程:查找当前文件夹及其子文件夹里面的 txt
#!/usr/bin/env python # coding:utf-8 # xcopy Lib directory and rename all files to *d.lib import os from os.path import join,exists import shutil from win32com.shell import shell, shellcon from msvcrt import getch root_path = r"E:\workspace\Src"