[Linux] moving avi-files
Posted: March 12th, 2009, 9:49 pm
Moves all avi-files, except filenames containing "sample"
I get a nice "buffer" when removing one week old files from that folder with a cronjob.
Edit:
I delete old files and folders with this command:
Code: Select all
#!/bin/bash
cd "$1"
FILES=`ls *.avi | grep -iv sample`
echo "moving avi files..."
echo $FILES
a=0;
F_ARRAY=( $FILES )
for file in $FILES
do
mv ${F_ARRAY[$a]} ~/downloads/extracted/
(( a += 1 ))
done
exit 0
Edit:
I delete old files and folders with this command:
Code: Select all
find /path/to/folder -depth -mindepth 1 -ctime +7 -delete