Jump to content
nuhll

Bash script, add one extention to it

1 post in this topic Last Reply

Recommended Posts

Hey,

i use the following script to move 2 extentions into a f older. Now i found out, that i need mkv also moved.

 

Quote

 


#!/bin/bash
FROM_DIR=/mnt/user/downloads/completed/Filme
TO_DIR=/mnt/user/downloads/DVDR

FILES="$(find "$FROM_DIR" -iname '*.iso' -or -iname '*.img')"
for FILES in $FILES; do
    DIR="$(basename "$(dirname "$FILES")")"
    mkdir -p "$TO_DIR"/"$DIR"
    mv "$FILES" "$TO_DIR"/"$DIR"
done
 

 

 

i tried:

 

Quote

 


#!/bin/bash
FROM_DIR=/mnt/user/downloads/completed/Filme
TO_DIR=/mnt/user/downloads/DVDR

FILES="$(find "$FROM_DIR" -iname '*.iso' -or -iname '*.img' -or -iname '*.mkv')"
for FILES in $FILES; do
    DIR="$(basename "$(dirname "$FILES")")"
    mkdir -p "$TO_DIR"/"$DIR"
    mv "$FILES" "$TO_DIR"/"$DIR"
done
 

 

 

but that dont work...

 

 

mv: cannot stat '/mnt/user/downloads/completed/Filme/name(62+63)': No such file or directory
mv: cannot stat 'name': No such file or directory
mv: cannot stat 'name1': No such file or directory
mv: cannot stat 'name2': No such file or directory
mv: cannot stat 'DTS': No such file or directory
mv: cannot stat '5.1': No such file or directory
mv: cannot stat 'MKV': No such file or directory
mv: cannot stat 'h264': No such file or directory
mv: cannot stat '1080p': No such file or directory
mv: cannot stat 'German': No such file or directory
mv: cannot stat 'by': No such file or directory
mv: cannot stat 'name4': No such file or directory
mv: cannot stat '-': No such file or directory
mv: cannot stat '5,39': No such file or directory
mv: cannot stat 'GB/name.mkv': No such file or directory
find: `/mnt/user/downloads/DVDR/Filme': No such file or directory
find: `/mnt/user/downloads/DVDR/GB': No such file or directory

 


I dont know how i can extent the list with ".mkv", i guess -or only takes 2 values, but how to do multiple?

Edited by nuhll

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now