Import sys, OS, time, shutil
From stat import st_atime, st_ctime, st_mtime
From win32file import copyfile
Def test (Self ):
Remotedir = "\\\\ Orc-Fs \ builds \ FP \ builds01 \ flair \ main"
Localdir = "d :\\ main"
I = 0
For name in OS. listdir (remotedir ):
Print Name
If I = 3:
Break
Shutil. copytree (OS. Path. Join (remotedir, name), OS. Path. Join (localdir, name), true)
Try:
STAT1 = OS. Stat (OS. Path. Join (remotedir, name ))
Print STAT1
Print time. ctime (STAT1 [st_ctime]), time. ctime (STAT1 [st_mtime])
Failed t OS. Error:
SYS. stderr. Write ("error ")
SYS. Exit (1)
Try:
OS. utime (OS. Path. Join (localdir, name), (STAT1 [st_ctime], STAT1 [st_mtime])
Stat2 = OS. Stat (OS. Path. Join (localdir, name ))
OS. Path. getctime (OS. Path. Join (localdir, name ))
Print time. ctime (stat2 [st_ctime]), time. ctime (stat2 [st_mtime])
Failed t OS. Error:
SYS. stderr. Write ("error ")
SYS. Exit (2)
If STAT1 [st_ctime] = stat2 [st_ctime] And STAT1 [st_mtime] = stat2 [st_mtime]:
Print "good"
I + = 1
Def compare (Self ):
Remotedir = "\\\\ Orc-Fs \ builds \ FP \ builds01 \ flair \ main"
Localdir = "d :\\ main"
Files = [(OS. path. getmtime (OS. path. join (remotedir, x), OS. path. join (remotedir, x) for X in OS. listdir (remotedir)]
Files. Sort ()
Files. Reverse ()
For item in files:
Print item
If _ name _ = "_ main __":
# Test (1)
Compare (1)