I have two list. One is a list of files and the other a list of folders.
list1[file1,file2,file3,file4]
list2[folder1,folder2]
I want to move:
- file1 to folder1
- file2 to folder2
- file3 to folder1
- file4 to folder2
I have two list. One is a list of files and the other a list of folders.
list1[file1,file2,file3,file4]
list2[folder1,folder2]
I want to move:
This is a great time to use the itertools
built in library!
import itertools
files = ["file1","file2","file3","file4"]
folders = ["folder1","folder2"]
for file, folder in zip(files, itertools.cycle(folders)):
print("move {} to {}".format(file, folder))
This is only the code for the round robin. The moving of files should be pretty easy. Look at the os
module.
Feel free to ask if you have any questions.