DroidX
DroidX

Reputation: 59

BASH while loop and qt-faststart

I am not very familiar with bash scripting, so I need a small help from you guys.

I have a directory on my Gentoo server with several hundred videos and every video has a date in its name (09092015.mp4, 10092015.mp4 etc.). I need a while loop that will copy all those files on new location with qt-faststart and keep their original name.

EDIT:

I have tried this code.

filename=${*.mp4}

while true;

qt-faststart $filename /backup/$filename
fi
done

Upvotes: -1

Views: 165

Answers (1)

agold
agold

Reputation: 6276

You can iterate over the files and run qt-faststart:

for filename in *.mp4; do
  qt-faststart $filename /backup/$filename
done

If you want to include files in sub directories you can use find:

for filename in $(find . -name '*.mp4'); do
  qt-faststart $filename /backup/$filename
done

Upvotes: 2

Related Questions