Move files of a certain year to other directory

Hi all,

I have a massive amount of recording files in .WAV format stored in a directory, files dating back to 2006.

It is a huge amount of files as Linux cannot even do a listing of it all, it states: "argument list too long"

What I would like to do is the following:
Find all the files of each specific year, zip them individually in type .gz, and move them to a folder, like move all files for the year 2006 into a folder called "Rec_2006", but also zip them while moving if at all possible.
Same for 2007 and onwards ...
If they cannot be zipped it is not a train smash.

As from there I will back them up to tape to be able to free up some space on the server.

Any help at being able to do this will be much appreciated.

Thanks.

Is there a naming convention for the files, or is the distinction based on the modification time of the files? Or something else?

Apologies

The distinction is based on creation date of the files.

Examples will look similar to this:

Aug  3  2007 20070803-142942-1186144182.202734.WAV.gz
Aug  3  2007 20070803-154033-1186148433.204958.WAV.gz
Aug  3  2007 20070803-155954-1186149594.205511.WAV.gz
Aug  3  2007 20070803-162047-1186150831.206103.WAV.gz
Aug  6  2007 20070806-085914-1186383554.212839.WAV.gz
Aug  6  2007 20070806-090509-1186383909.213104.WAV.gz
Aug  6  2007 20070806-092228-1186384928.213627.WAV.gz
Aug  6  2007 20070806-100016-1186387199.383.WAV.gz

I then basically want to move all the files from 1 January to 31 December 2007 into a folder, and so on for each year.

So the file names are already based on the recording date? Or should the result be named as such? Because from what information you've given that's not clear.

That was a bad example as those were results, with the date pre-pended to the existing file names.
The date in the filename is not really needed, as long as the files for a specific year is moved to the correct folder.

Better file examples might be:

Apr 16 12:36 q1234--1271413803.344399.WAV
Apr 16 12:32 q1234--1271413847.344480.WAV
Apr 22 09:22 OUT1391--1271920802.559720.WAV
Apr 22 09:29 OUT1391--1271921281.560443.WAV
Apr 22 09:34 OUT1391--1271921538.560845.WAV

Thanks

How can you recognize the year of the files?

Since I don't have your environment, this is more or less untested:

for (( year=2000; year<=2011; year++ )); do
    echo mkdir -p rec_${year}
    touch -t "${year}01010000" reference
    find . -maxdepth 1 -iname '*.wav' '!' -newer reference \
        -exec echo mv {} rec_${year}/. \; \
        -exec echo gzip -9 rec_${year}/{} \;
done

Try it first like this, and if the results look reasonable, remove the echos.