[Linux] moving avi-files

Come up with a useful post-processing script? Share it here!
Post Reply
Laat
Newbie
Newbie
Posts: 9
Joined: March 12th, 2009, 9:40 pm

[Linux] moving avi-files

Post by Laat »

Moves all avi-files, except filenames containing "sample"

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
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

find /path/to/folder -depth -mindepth 1 -ctime +7 -delete
Last edited by Laat on April 10th, 2009, 7:02 am, edited 1 time in total.
hibbs
Newbie
Newbie
Posts: 1
Joined: March 17th, 2012, 6:17 pm

Re: [Linux] moving avi-files

Post by hibbs »

is there a way to edit this to also add support to move mp4's and mkv's as well please?

EDIT: Nevermind i think i got it under control now.....

Code: Select all

#!/bin/bash
cd "$1"

FILES=`ls *.avi *.mp4 *.mkv | grep -iv sample`
echo "moving avi files..."
echo $FILES

a=0;
F_ARRAY=( $FILES )
for file in $FILES
do
        mv ${F_ARRAY[$a]} /leech/files
        (( a += 1 ))
done
exit 0
Post Reply