# coding=gbk
import filecmp
import os
import shutil
import time
def copy_file(src_file_name, dst_file_name):
if not os.access(src_file_name, os.F_OK):
print '%s does not exist' %(src_file_name)
return -1
print 'copy %s' %(src_file_name)
shutil.copy(src_file_name, dst_file_name)
def del_file(file_name):
if not os.access(file_name, os.F_OK):
print '%s does not exist' %(file_name)
return -1
print 'del %s' %(file_name)
os.remove(file_name)
if __name__ == '__main__':
src_file_name = "1.txt"
dst_file_name = "2.txt"
while (1):
copy_file(src_file_name, dst_file_name)
#del_file(dst_file_name)
time.sleep(1)
import filecmp
import os
import shutil
import time
def copy_file(src_file_name, dst_file_name):
if not os.access(src_file_name, os.F_OK):
print '%s does not exist' %(src_file_name)
return -1
print 'copy %s' %(src_file_name)
shutil.copy(src_file_name, dst_file_name)
def del_file(file_name):
if not os.access(file_name, os.F_OK):
print '%s does not exist' %(file_name)
return -1
print 'del %s' %(file_name)
os.remove(file_name)
if __name__ == '__main__':
src_file_name = "1.txt"
dst_file_name = "2.txt"
while (1):
copy_file(src_file_name, dst_file_name)
#del_file(dst_file_name)
time.sleep(1)