Sample Header Ad - 728x90

Sync two directories: same filename, different fileending, different filecontent

0 votes
1 answer
178 views
I have 2 folders with subdirectories. One with training images and one with training labels. - One image belongs to exactly one label - The image and the label have different content - The image and the label can be found in similar paths. e.g.: - **images**/18/1334/image1.**webp** - **labels**/18/1334/image1.**png** - The filename (not the extension) is the same - There can be multiple files in one subdirectory How can I remove every label which has no corresponding image (and the other way round)? For example: images: . |---18 |---a1 | |---a1.webp | |---a11.webp |---a2 | |---a2.webp |---a3 labels . |---18 |---a1 | |---a1.png | |---a11.png |---a2 | |---a2.png |---a3 |---a3.png --- Okayish solution (remove files if there are no corresponding labels or images): . |---18 |---a1 | |---a1.* | |---a11.* |---a2 | |---a2.* |---a3 Best solution (remove the folders which are empty now, too): . |---18 |---a1 | |---a1.* | |---a11.* |---a2 |---a2.* The asterisk* stands for webp or png.
Asked by AG_exp (15 rep)
Jul 1, 2019, 02:56 PM
Last activity: Jul 2, 2019, 11:07 AM