Skip to navigation
Move a list of files from one location to another in python
14.03.18
for i in files: if i.endswith('Thumbs.db'): continue try: src = '{}{}'.format(self.picture_path,i) dst = '{}{}'.format(self.picture_path_archive,i) if os.path.isdir(self.picture_path_archive): a =i.rsplit('/',1) if(len(a)>1): src_dics = '{}{}'.format(self.picture_path_archive,a[0]) if not os.path.isdir(src_dics): os.makedirs(src_dics) print('...move: {} \t -----> \t {}'.format(src,dst)) shutil.move(src, dst) except Exception as e: print(e)
https://docs.python.org/3/library/shutil.html#module-shutil
Reply
Anonymous
Information Epoch 1760617020
Make every program a filter.
Home
Notebook
Contact us