First I would do this to give you a txt file with a list of all the files that were last MODIFIED (it's difficult to do creation date in linux from what I've read) on April 29, 2006:
Code:
#!/bin/bash
for file in *; do
mtime=$(stat "$file" -c%y | cut -d" " -f1)
if [ $mtime == 2006-04-29 ]; then
echo $file >> files20060429.txt
fi
done
Look at
files20060429.txt and make sure it contains all the files you expect it to. Move it to another directory so that it doesn't get deleted.
Then I would
mkdir remove and modify the script to move all the files NOT last modified on 2006-04-29 to this new folder
Code:
#!/bin/bash
for file in *; do
mtime=$(stat "$file" -c%y | cut -d" " -f1)
if [ $mtime != 2006-04-29 ]; then
echo $file
mv $file ./remove
fi
done
Then I'd look in the directory and make sure none of the files in
files20060429.txt are there by mistake. Then
rm -ir remove. And it should remove all the files in the directory you created.
Sorry, forgot to mention, the code above should be put into a text file called
whatevernameyouwant.sh and then
chmod +x whatevernameyouwant.sh to make it executable. You invoke the script by being in the same directory and then
./whatevernameyouwant.sh
Anyway, use this at your own risk, as I'm not responsible for lost data (another reason why I recommend trying it out with cp instead of mv until you are comfortable with the script doing what you want it to do)...