我正在尝试从内核文件夹复制 *.patch 文件并遇到以下错误
Traceback (most recent call last):
File "copytest.py", line 47, in <module>
main()
File "copytest.py", line 44, in main
copystuff(src,dest)
File "copytest.py", line 18, in copystuff
shutil.copytree(src, dest)
File "C:\CRMApps\apps\Python262\lib\shutil.py", line 140, in copytree
names = os.listdir(src)
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: '\\\\buildloc\\kernel\\*.patch/*.*'
代码:-
import argparse
import shutil, errno
import os
def copystuff(src, dest):
#print "IN COPY STUFF"
if os.path.isfile(src):
dest_dirname = os.path.dirname(dest)
#print "DEST DIR NAME" + dest_dirname
if not os.path.isdir(dest_dirname):
# print "MAKING DEST DIR"
os.makedirs(dest_dirname)
print src
print dest
shutil.copy2(src, dest)
else:
print src
print dest
shutil.copytree(src, dest)
def main ():
copy_list=[r'\kernel\*.patch']
#copy_list=['out\target\product\msm8226\obj\KERNEL_OBJ\vmlinux']
parser = argparse.ArgumentParser(description='This is copy binaries for android build script)
parser.add_argument('-v','--build_version',action='store',dest='build_version',help='<Required> Build version',required=True)
parser.add_argument('-s','--source',action='store',dest='source',help='<Required> source path',required=True)
parser.add_argument('-d','-destination',action='store',dest='destination',help='<Required>destination path',required=True)
results = parser.parse_args()# collect cmd line args
build_version = results.build_version
print "BUILD_VERSION: " + build_version
source = results.source
print "SOURCE PATH: " + source
destination = results.destination
print "DESTINATION PATH: " + destination
dest_fastboot= destination + r'\out\target\product\msm8226'
if not os.path.isdir(dest_fastboot):
# print "MAKING DEST DIR"
os.makedirs(dest_fastboot)
shutil.copy2('Fastboot_load.bat', dest_fastboot)
for item in copy_list:
item = item.strip()
print "ITEM: " + item
src = source + item
dest = destination + item
copystuff(src,dest)
if __name__ == '__main__':
main()