python拷贝文件小程序(windows)

 1 #!/usr/bin/python
 2 
 3 import os
 4 
 5 source='F:\\lh.jpg'
 6 target='E:\\'
 7 copy_command="xcopy %s %s"%(source,target)
 8 print copy_command
 9 if os.system(copy_command)==0:
10     print 'Successful copy to',target
11 else:
12     print 'Copy FAILED'

把文件lh.jpg拷贝到E盘下,使用的是windows下的xcopy命令。

posted @ 2016-02-28 12:34  jiu~  阅读(411)  评论(0编辑  收藏  举报