jdusablon
February 25th, 2008, 09:08 PM
Hi and thanks in advance to everyone for any help.
I'm trying to write a command or short script that will walk through a directory structure, find all the jpg files and roll them into rar files (actually cbr files) named after their parent directory.
If you haven't guessed it already, I've got 28 graphic novels containing 15 to 20 chapters, each of which contains about 60 jpg files. I'm trying to make nice and neat CBR files for comix. Directory structure goes like this: volume01/chapter001/blahblah001.jpg
You can imagine how much work this amounts to manually, not to mention all the human error I'll likely introduce trying to repeat the same process 500 times.
*******
What I've got so far:
The following gives a nice directory name of each file in all subdirectories:
find -iname *.jpg -exec dirname {} \;
I'm trying the following, but it keeps trying to make a single archive called .cbr that gets overwritten each time the directory changes:
find -iname *.jpg -exec rar a `dirname {}`.cbr {} \;
It seems like the dirname {} is not working where/how it is presently.
I just need a pointer, and yes, I am reading up on the subject.
I'm trying to write a command or short script that will walk through a directory structure, find all the jpg files and roll them into rar files (actually cbr files) named after their parent directory.
If you haven't guessed it already, I've got 28 graphic novels containing 15 to 20 chapters, each of which contains about 60 jpg files. I'm trying to make nice and neat CBR files for comix. Directory structure goes like this: volume01/chapter001/blahblah001.jpg
You can imagine how much work this amounts to manually, not to mention all the human error I'll likely introduce trying to repeat the same process 500 times.
*******
What I've got so far:
The following gives a nice directory name of each file in all subdirectories:
find -iname *.jpg -exec dirname {} \;
I'm trying the following, but it keeps trying to make a single archive called .cbr that gets overwritten each time the directory changes:
find -iname *.jpg -exec rar a `dirname {}`.cbr {} \;
It seems like the dirname {} is not working where/how it is presently.
I just need a pointer, and yes, I am reading up on the subject.