Linux genisoimage Batch

2019-09-16 12:33发布

问题:

So i have the following directories:

/shares/media/movies /shares/media/series

How can I loop through each directory recursively and whenever it finds a folder called VIDEO_TS, let Genisoimage convert that folder to an iso image, the name of the iso would be the parent folder's name.

Very complex and as I am not a guru with these things, I decided to ask it as question on Stackoverflow.

The command that I use for a single directory:

genisoimage -o movie_1.iso -dvd-video /shares/media/movies/Movie 1

回答1:

find /tmp/ -type d -name VIDEO_TS

for example this looks for any directory named VIDEO_TS under /tmp

at this point you only need to iterate over the result

for file in $(find /tmp/ -type d -name VIDEO_TS);do echo $file;done;

in this case the action performed for every match is echo $file which simply prints out the name of the record that matches your search, you can easily adapt this to perform any kind of command line task.



标签: linux