file.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import os
  2. import sys
  3. import shutil
  4. if sys.platform=="linux":
  5. source="/home/zhanhc/webrtc-checkout/src"
  6. dest ="/home/zhanhc/EgoSln/webrtc/include/linux"
  7. else:
  8. #source="D:/webrtc-m75/src"
  9. source="F:/Github/webrtc-checkout/src"
  10. dest="e:/EgoSln/webrtc/include/"
  11. def subdir(srcpath,dstpath):
  12. files=os.listdir(srcpath)
  13. for file in files:
  14. a=os.path.join(srcpath,file)
  15. if(os.path.isfile(a)):
  16. if a.endswith(".h"):
  17. if os.path.exists(dstpath) ==False:
  18. os.makedirs(dstpath)
  19. shutil.copyfile(a,os.path.join(dstpath,file))
  20. elif os.path.isdir(a):
  21. dst=os.path.join(dstpath,file)
  22. subdir(a,dst)
  23. def main():
  24. dstpath=dest
  25. path=source
  26. files = os.listdir(source)
  27. for file in files:
  28. a=os.path.join(path,file)
  29. if(os.path.isfile(a)):
  30. if a.endswith(".h"):
  31. if os.path.exists(dstpath) ==False:
  32. os.makedirs(dstpath)
  33. shutil.copyfile(a,os.path.join(dstpath,file))
  34. elif os.path.isdir(a):
  35. dst=os.path.join(dstpath,file)
  36. subdir(a,dst)
  37. main()
  38. #print(root)
  39. #print(files)
  40. #for dir in dirs:
  41. # paths=os.path.join(source,dir)
  42. # print(paths)