|
From: Justin C on 10 Apr 2008 10:23 I have directories [0-9a-z], in those directories are .jpg files and thumbnails of those .jpgs, these are identified by having the same file name but prepended by 'th'. There are about 60MB of images in total so, to make them more download friendly, we tar and gzip them into files about 20MB. It turns out that our customers aren't having a lot of fun with .tgz files - what I mean is, they can't extract them. Now, maybe they're dum, but they're customers, so I intend to give them what they want. I did look at using tar with zip but it doesn't seem to play ball in the same way. Here's the command line I use to create the tgz files: tar zcf /home/justin/tmp/images1.tgz 0 1 2 3 4 5 6 7 8 9 a b c d e f --exclude=th* --exclude=*htaccess --exclude=*html tar zcf /home/justin/tmp/images2.tgz g h i j k l m --exclude=th* --exclude=*htaccess --exclude=*html tar zcf /home/justin/tmp/images3.tgz n o p q r s t u v w x y z --exclude=th* --exclude=*htaccess --exclude=*html Reading man zip I find that if I us '-' as the output file for tar, and '-' as the input for zip I should get what I want, but it doesn't work right at all, here's what I tried: tar cf - n o p q r s t u v w x y z --exclude=th* --exclude=*htaccess --exclude=*html | zip /home/justin/tmp/images3.zip - When the command runs I get "adding -". If I unzip (this is on a Mac) I get a directory called '-' while unzipping is happening, that get's replaced by a directory '- 2', and in that directory are the directories [n-z]. This isn't too bad, but I'd much prefer the extraction to just create the directories [n-z] in the current working directory becuase for the other two commands, other directories are created to hold *those* directories, they then all need shuffling together, and if our customers are dum, then I want to make it as easy as possible. Any ideas how I can get this to work will be gratefully received. Justin. -- Justin C, by the sea.
From: Paul Black on 10 Apr 2008 10:52 On Apr 10, 3:23 pm, Justin C wrote: > Any ideas how I can get this to work will be gratefully received. Any reason you don't just use zip on its own? Paul
From: Ian Rawlings on 10 Apr 2008 10:51 On 2008-04-10, Justin C <justin.0804(a)purestblue.com> wrote: > Reading man zip I find that if I us '-' as the output file for tar, and > '-' as the input for zip I should get what I want, but it doesn't work > right at all, here's what I tried: I don't think that using tar piping into zip will get you what you want, unless you want something *really* odd.. Tar will produce a tar archive, then you are trying to add that to a zip file. If you managed to do it, you'd end up with a zip file containing a tar file, so your customers would then need to extract the tar file from the zip file then extract the files from the tar file.. If all you are trying to do is to create a zip file containing the files then you need to look at using zip alone, not using tar. Have a look at zip's "-i" option, assuming you are using info-zip. -- Blast off and strike the evil Bydo empire! http://youtube.com/user/tarcus69 http://www.flickr.com/photos/tarcus/sets/
From: Justin C on 10 Apr 2008 11:16 On 2008-04-10, Ian Rawlings <news06(a)tarcus.org.uk> wrote: > On 2008-04-10, Justin C <justin.0804(a)purestblue.com> wrote: > >> Reading man zip I find that if I us '-' as the output file for tar, and >> '-' as the input for zip I should get what I want, but it doesn't work >> right at all, here's what I tried: > > I don't think that using tar piping into zip will get you what you > want, unless you want something *really* odd.. Tar will produce a tar > archive, then you are trying to add that to a zip file. If you > managed to do it, you'd end up with a zip file containing a tar file, > so your customers would then need to extract the tar file from the zip > file then extract the files from the tar file.. > > If all you are trying to do is to create a zip file containing the > files then you need to look at using zip alone, not using tar. Have a > look at zip's "-i" option, assuming you are using info-zip. I always forget info pages... but in this case (as in most, when I've checked) it's the same as the man anyway. You're right, I hadn't thought that through, of course what is left is a tar, after unzipping. I'll have another bash at it with the -i option, that does look a more likely solution. Thanks also to Paul for the prompt reply, suggesting pretty much the same thing - don't use tar. Justin. -- Justin C, by the sea.
From: Will Kemp on 10 Apr 2008 14:24 On Thu, 10 Apr 2008 14:23:41 +0000, Justin C wrote: > I have directories [0-9a-z], in those directories are .jpg files and > thumbnails of those .jpgs, these are identified by having the same file > name but prepended by 'th'. There are about 60MB of images in total so, > to make them more download friendly, we tar and gzip them into files > about 20MB. It turns out that our customers aren't having a lot of fun > with .tgz files - what I mean is, they can't extract them. Now, maybe > they're dum, but they're customers, so I intend to give them what they > want. I did look at using tar with zip but it doesn't seem to play ball > in the same way. > > Here's the command line I use to create the tgz files: > > tar zcf /home/justin/tmp/images1.tgz 0 1 2 3 4 5 6 7 8 9 a b c d e f > --exclude=th* --exclude=*htaccess --exclude=*html > > tar zcf /home/justin/tmp/images2.tgz g h i j k l m --exclude=th* > --exclude=*htaccess --exclude=*html > > tar zcf /home/justin/tmp/images3.tgz n o p q r s t u v w x y z > --exclude=th* --exclude=*htaccess --exclude=*html > > > Reading man zip I find that if I us '-' as the output file for tar, and > '-' as the input for zip I should get what I want, but it doesn't work > right at all, here's what I tried: > > tar cf - n o p q r s t u v w x y z --exclude=th* --exclude=*htaccess > --exclude=*html | zip /home/justin/tmp/images3.zip - > > When the command runs I get "adding -". If I unzip (this is on a Mac) I > get a directory called '-' while unzipping is happening, that get's > replaced by a directory '- 2', and in that directory are the directories > [n-z]. This isn't too bad, but I'd much prefer the extraction to just > create the directories [n-z] in the current working directory becuase > for the other two commands, other directories are created to hold > *those* directories, they then all need shuffling together, and if our > customers are dum, then I want to make it as easy as possible. I'm not suggesting a solution to your archive format question, just an observation about compression... jpeg is a compressed file format - and compressing an already compressed file is never a very good idea. There are two reasons it's not a good idea - firstly, it's unnecessary, and a waste of effort. Secondly, the files usually end up bigger than they started! If your customers can deal with tar files, why not just forget the compression part of the process and give them tar files of the jpegs? -- http://SnapAndScribble.com/will/blog http://WillKemp-Words.com http://WillKemp-photos.com
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Clipboards In X - Why Do they Vanish? Next: Extracting keywords from text |