Sep-01-2018, 04:13 PM
I want to rename the images in a folder with images in another folder. after trying a while it seems bit tricky.
My images in the source folder looks like the following
I have tried os.rename as follows
My images in the source folder looks like the following
Quote:1305031102.175304.pngI want to give same names as above to the images in another folder with names as following
1305031102.211214.png
1305031102.243211.png
1305031102.275326.png
1305031102.311267.png
1305031102.343233.png
1305031102.375329.png
1305031102.411258.png
1305031102.443271.png
Quote:0000000.png
0000001.png
0000002.png
0000003.png
I have tried os.rename as follows
import os import numpy as np path= "/home/ujjval/Downloads/rgbd_dataset_freiburg1_xyz/rgb/" path1="/home/ujjval/Downloads/video-image/data/" list1=os.listdir("/home/ujjval/Downloads/rgbd_dataset_freiburg1_xyz/rgb/") list2=os.listdir("/home/ujjval/Downloads/video-image/data/") list1.sort() list2.sort() print(list1); print(list2); i=1 print(str(path)) #for file in path: # for files in path1: #os.rename(os.path.join(path,file), os.path.join(path1,files)) #os.rename("/home/ujjval/Downloads/rgbd_dataset_freiburg1_xyz/rgb/"+ str(file), "/home/ujjval/Downloads/video-image/data/"+str(file) +".png" )