This is my schript so far:
Code: Select all
#path=$find /volume1/pathToMovies -type f -newermt '5 minutes ago' -iname 'movie.nfo' {} +
#echo $path
path=$(grep -i "Marvel" find /volume1/pathToMovies/ -type f -newermt '5 minutes ago' -iname 'movie.nfo')
file=$(grep -i "Marvel" /volume1/pathToMovies/movie.nfo)
file2=$(grep -i "Disney" /volume1/pathToMovies/movie.nfo)
#echo $file
if [[ $file/* == *"Marvel"* ]];
then
Collection="Marvel Movies"
find /volume1/pathToMovies/ -type f -newermt '5 minutes ago' -iname 'movie.nfo' -exec sed -i.bak 's|<set />.*|<set>Marvel Movies</set>|g' {} +
find /volume1/pathToMovies/ -type f -newermt '5 minutes ago' -iname 'movie.nfo' -exec sed -i.bak 's|<set>.*|<set>Marvel Movies</set>|g' {} +
elif [[ $file2/* == *"Disney"* ]];
then
Collection="Disney Movies"
find /volume1/video/Filme_Test/ -type f -newermt '5 minutes ago' -iname 'movie.nfo' -exec sed -i.bak 's|<set />.*|<set>Disney Movies</set>|g' {} +
find /volume1/video/Filme_Test/ -type f -newermt '5 minutes ago' -iname 'movie.nfo' -exec sed -i.bak 's|<set>.*|<set>Disney Movies</set>|g' {} +
else
echo "No Changes"
fi
This ist working, as long as i deliver the specific path to the movie.nfo file. But what i want is, that every movie.nfo file that got changed within the last 5 minutes and is located in a subdirectory of the 'pathToMovies' Directory get checked and changed if 'Marvel' or 'Disney' occurs in that file. Like i said, its working when i give the specific path, but i want this autmomatic, which is why i need to use the find command. I just dont know how to use it right.
Pls help