#!/bin/bash
# script to find and move files
SOURCE=/DRIVE2/folder/
DESTDIR=/DRIVE/new3/
MOVEFILES=(mpg avi m4v mp4 3gp mpeg MOV)
# this line above is not working, its only reading the first extension
find $SOURCE -type f -name *.$MOVEFILES -print | xargs -i mv -v "{}" $DESTDIR
Can you guys help me with my bash script? The $MOVEFILES
part of my script is not working. It's only reading the first extension I put there which is mpg
. The rest is being ignored. What is the proper way to write that line?
Also is it possible to include the directory its from lets say
/DRIVE2/folder1/folder2/folder3/folder4/file.ext
move to /DRIVE/folder3/folder4/file.ext
folder1/folder2/...
to retain?