Esempio n. 1
0
 def action(self, src, mpath):
     loc = mpath.search_attrib(self.ctime, lambda mpath: mpath.ctime)
     path = mpath.get_mpath_at(loc).path
     src = src + '\\' + str(self.ctime) + str(self.mtime) + self.name
     resources.delete_file(path)
     resources.rename_file(src, path)
     resources.set_time(path, ctime=self.ctime, mtime=self.mtime)
Esempio n. 2
0
 def action(self, mpath):
     loc0 = mpath.search_attrib(self.ctime, lambda mpath: mpath.ctime)
     path0 = mpath.get_mpath_at(loc0).path
     loc1 = mpath.search_attrib(self.dst_ctime, lambda mpath: mpath.ctime)
     path1 = mpath.get_mpath_at(loc1).path + '\\' + self.name
     resources.rename_file(path0, path1)
     resources.set_time(path1, ctime=self.ctime, mtime=self.mtime)
Esempio n. 3
0
 def make_ctimes_identical(mpath, ctime=None):
     if ctime == None:
         ctime = mpath.ctime
     #### make ctime identical ####
     # mpath
     resources.set_time(mpath.path, ctime)
     # sub_mpath
     for sub_mpath in mpath.sub_mpaths:
         make_ctimes_identical(sub_mpath, ctime)
Esempio n. 4
0
def bind_paths(mpath, path0, path1):
    '''
    binds the files of two identically named paths together using creation time
    parameters: string path0, string path1 | return: none
    '''
    #### bind ####
    # mpath
    path = mpath.path.replace(
        path0, path1
    )  # replaces the path to the files mapped on mpath(path0) with the path to the other files(path1)
    ctime = mpath.ctime
    mtime = mpath.mtime
    resources.set_time(
        path, ctime, None, mtime
    )  # sets the times of the other files to the times of files mapped on mpath
    # sub_mpath
    for sub_mpath in mpath.sub_mpaths:
        bind_paths(sub_mpath, path0, path1)