(src, dst)
Copy all stat info (mode bits, atime, mtime, flags) from src to dst
Copy all stat info (mode bits, atime, mtime, flags) from src to dst
Copy all stat info ( mode bits atime mtime flags ) from src to dst
def copystat(src, dst):
    """Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
    st = os.stat(src)
    mode = stat.S_IMODE(st.st_mode)
    if hasattr(os, 'utime'):
        os.utime(dst, (st.st_atime, st.st_mtime))
    if hasattr(os, 'chmod'):
        os.chmod(dst, mode)
    if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
        try:
            os.chflags(dst, st.st_flags)
        except OSError, why:
            if (not hasattr(errno, 'EOPNOTSUPP') or
                why.errno != errno.EOPNOTSUPP):
                raise
def copystat ( src , dst ) : st = os . stat ( src ) mode = stat . S_IMODE ( st . st_mode ) if hasattr ( os , 'utime' ) : os . utime ( dst , ( st . st_atime , st . st_mtime ) ) if hasattr ( os , 'chmod' ) : os . chmod ( dst , mode ) if hasattr ( os , 'chflags' ) and hasattr ( st , 'st_flags' ) : try : os . chflags ( dst , st . st_flags ) except OSError , why : if ( not hasattr ( errno , 'EOPNOTSUPP' ) or why . errno != errno . EOPNOTSUPP ) : raise