对不起,我有:
directory A at the path = /Users/John/Desktop/test_1
目录A中的文件夹结构如下:
./fashion
./.DS_Store
./fashion/clothes
./fashion/.DS_Store
./fashion/2.jpg
./fashion/3.jpg
./fashion/1.jpg
./fashion/clothes/sneakers
./fashion/clothes/.DS_Store
./fashion/clothes/sneakers/2.jpg
./fashion/clothes/sneakers/3.jpg
./fashion/clothes/sneakers/1.jpg
directory B at the path = /Users/John/Desktop/test_2
目录B中的文件夹结构如下:
./fashion
./.DS_Store
./fashion/clothes
./fashion/.DS_Store
./fashion/clothes/sneakers
./fashion/clothes/high_heels
./fashion/clothes/.DS_Store
我试图基于文件夹名称匹配将文件从目录A复制到目录B,以便在目录B中具有以下内容。如果目录B中没有folder_name,请不要复制图像。
编辑:确切的文件路径不必匹配,只是IF(目录A中文件夹的名称)==(目录B中文件夹的名称),复制内容将文件夹A放入文件夹B。否则,什么也不做。
fashion: img1, img2
fashion > clothes: img1, img2
fashion > clothes > sneakers: img1, img2
fashion > clothes > high-heels: {}
再次感谢您!
答案 0 :(得分:1)
您可以尝试shitil:
add
答案 1 :(得分:0)