def done(self, next_phase, backup) : if self.dst is not None and self.isTop : # move to top filetools = FileTools(self.dst, self.dst) filetools.move_sub_into('folders') filetools.remove_empty() # rename folder to just number count = 1 for name in os.listdir(self.dst) : name = os.path.join(self.dst, name) if not os.path.isdir(name) : continue dst = os.path.join(self.dst, "{0:02d}".format(count)) while os.path.exists(dst) : count += 1 dst = os.path.join(self.dst, "{0:02d}".format(count)) os.rename(name, dst) # make 'System' and 'Other' folder for name in ['System', 'Other'] : name = os.path.join(self.dst, name) os.mkdir(name) # move dst to next filetools = FileTools(self.dst, os.path.join(next_phase, os.path.basename(self.dst))) filetools.safe_move() # move src to backup filetools = FileTools(self.src, os.path.join(backup, os.path.basename(self.src))) filetools.safe_move()
def move_to_av(self) : move = os.path.join(self.move_to, '#move') if self.move_to_db is None : return for name in os.listdir(move) : src = os.path.join(move, name) dest = os.path.join(self.move_to_db, name) tool = FileTools(src, dest) tool.safe_move()