mardi 11 août 2020

How do I shuffle files in a certain directory using python or terminal?

I have scraped an image dataset from the internet with two categories. A and B. Now, they are stored in a directory like follows:

a1, a2, a3 ..... a351 and then b1, b2, b3 ..... b351. (after all the A files the B files start immediately)

How can I put them in a random manner? I tried sorting them by size but the B files are heavier so they group together at the top. I am in ubuntu and tried using the shuf command but it doesn't work for me. Is there any way I could sort the files randomly using bash or python?

Thanks




Aucun commentaire:

Enregistrer un commentaire