Skip to content

Instantly share code, notes, and snippets.

@enric1994
Last active March 1, 2019 12:42
Show Gist options
  • Save enric1994/34e6b36f2d6f10ac2027d7d6a1be55a0 to your computer and use it in GitHub Desktop.
Save enric1994/34e6b36f2d6f10ac2027d7d6a1be55a0 to your computer and use it in GitHub Desktop.
Some Bash operations to organize datasets
#remove the first 4 characters of each JPG file: 1234asd.jpg -> asd.jpg
for f in *.jpg; do mv "$f" "$(echo $f|cut -c 4-)"; done
#move 350 random files starting with 0* to myfolder
ls 0* | shuf -n 350 | xargs -i mv {} myfolder
#check duplicates (apt install fdupes)
fdupes -r -m myfolder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment