Hi, I have used the following code snippet to copy files or folder from remote machine to local machine. I have used the same method to copy files to remote machine.
Can some one point me to solve this? Or Help needed to copy files or folders from remote machne ot lcoal one and also remote to remote copy if possible. thanks Siddhartha -------------------------------------------------------------------- def netToLocalCopy(hostName, userName, password, source, destPath, move=False): "Copies files or directories from a remote computer to local machine." #Establish the connection to remote machine wnet_connect(hostName, userName, password) # Get the UNC Path of the Destination Path src_dir = convert_unc(hostName, source) # Pad a backslash to the destination directory if not provided. if not destPath[len(destPath) - 1] == '\\': destPath = ''.join([destPath, '\\']) mesg = "Copying %s to %s Destination Directory on local host" % (src_dir, destPath) print mesg # Create the destination dir if its not there. if not os.path.exists(destPath): os.makedirs(destPath) else: # Create a directory anyway if file exists so as to raise an error. if not os.path.isdir(destPath): os.makedirs(destPath) print os.listdir(src_dir) try: if move: shutil.move(src_dir, destPath) else: shutil.copy(src_dir, destPath) except OSError, erno: print erno print sys.exc_info() return 1 return 0 ------------------------------------------------------------------------------------------------------- shutil.copy(src_dir, destPath) File "C:\Python25\lib\shutil.py", line 80, in copy copyfile(src, dst) File "C:\Python25\lib\shutil.py", line 46, in copyfile fsrc = open(src, 'rb') IOError: [Errno 13] Permission denied: '\\\\test7\\G$\\Test Lib'
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32