Moving files in the keywords dataset

I wanted to use 600 samples in place of the 1,500 samples in each class. I used
the zsh (Z-Shell) with:
mv – *([1,600]) /other/location/

For more details see: Moving Files in AI Datasets

I always do this one-liner which chooses random 600 files:

ls noise/*.wav | sort -R | tail -600 | xargs -J{} cp {} noise_600

2 Likes

Thanks for your one-liner. Using xargs is new to me.
What does the -J option do?

The -J option is used in a Macintosh terminal. The -I option is used on Linux.
Here is what the -I option does:
The -I option changes the way the new command lines are built. Instead of adding as many arguments as possible at a time, xargs will take one name at a time from its input, look for the given token ({} here) and replace that with the name.
https://unix.stackexchange.com/questions/282403/xargs-i-option

2 Likes

Yes, -I and -J are for placeholder.