Created
March 1, 2019 16:00
-
-
Save carloscabo/dc61e58a1ab37b148b0bf8a5574db979 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Randomly copy certain amount of certain file type from one directory into another | |
shuf -zn8 -e *.jpg | xargs -0 cp -vt target/ | |
# shuf shuffles the list of *.jpg files in the current directory. | |
# -z is to zero-terminate each line, so that files with special characters are treated correctly. | |
# -n8 exits shuf after 8 files. | |
# xargs -0 reads the input delimited by a null character (from shuf -z) and runs cp. | |
# -v is to print every copy verbosely. | |
# -t is to specify the target directory. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment