Python Forum
Rename files in two different folders
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rename files in two different folders
#2
If the files in your second folder are defining the names, then you can read the files of this folder (see: https://stackoverflow.com/questions/3207...-directory)
since the last digits of the files in both folders match you can use the split function on the .jpeg file names
for example
some_file_2dir = '07_2506.jpeg'
new_name = '%s.xml'%some_file_2dir.split('_')[1].split('.')[0]
and since you can call system functions like the move command mv you can then move the files of the first folder to the same location but with the new_name. Remember to check the names of the files in the first directory :)
Reply


Messages In This Thread
RE: Rename files in two different folders - by ThiefOfTime - May-28-2018, 08:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020