This article example describes how python implements the use of xcopy under linux. Shared for your reference. Specific as follows:
This python function is written to mimic the windows xcopy command and can be used under linux.
#!/usr/bin/python # -*- coding: UTF-8 -*- """ xcopy for Linux... Use: ______________________________________________________________________________ import sys, os (0,r"/path/to/LinuxXCopy") from LinuxXCopy import XCopy filters = ["*.py"] xc = XCopy((), "/tmp/test", filters) ______________________________________________________________________________ """ __author__ = "Jens Diemer" __license__ = """GNU General Public License v2 or above - /licenses/""" __url__ = "" __info__ = "" __version__="0.1" __history__=""" v0.1 - erste Version """ import os, shutil, fnmatch class XCopy: def __init__(self, src, dst, filters=[]): = filters (src, dst) def copytree(self, src, dst): """ Based in () """ names = (src) if not (dst): (dst) errors = [] for name in names: srcname = (src, name) dstname = (dst, name) if (srcname): (srcname, dstname) elif (srcname): if (name): print "copy:", name, dstname shutil.copy2(srcname, dstname) (src, dst) def filterName(self, fileName): for filter in : if (fileName, filter): return True return False
I hope that what I have described in this article will help you in your Python programming.