Run this, replacing /current/folder/ with the folder the files are in, .filetype with the file type, and /new/folder with the folder you are moving the files to.
$ mv /current/folder/*.filetype /new/folder
Tip: Don’t reinvent the wheel.
I have a lot of images, and I wanted to separate all of my .gif’s from the main folder, so this is what I did.
Create a file named organize_files, and paste this into it.
#!/bin/bash cd $2 for i in *$1; do mv `basename $i $1`$1 $3; done
Make it executable.
$ chmod +x organize_files
Move it to /usr/bin.
# mv organize_files /usr/bin/organize_files
Now, to move your files, make the directory you want to move them to, and run this.
$ organize_files FILETYPE CURRENTFOLDER NEWFOLDER
My pictures are in /home/kevin/pictures and I want my .gif’s in /home/kevin/gifs
$ organize_files .gif /home/kevin/pictures /home/kevin/gifs