How can I add filesnames with spaces to my zip archive?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Shell > How can I add filesnames with spaces to my zip archive?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How can I add filesnames with spaces to my zip archive?  
D. Alvarado


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-04-04 11:01 PM

Hello,
I am running Solaris 8 and using ksh.  I am trying to add some html
files to an existing zip archive.  The problem is, some of the zip
files contain spaces in the file name.  So when I try

find "$filename" -name "*.html" | xargs zip -r "$basename.zip"

I get a lot of errors ...

zip warning: name not matched: /export/home/dalvorad/Liv
zip warning: name not matched: files
zip warning: name not matched: to
zip warning: name not matched: convert/sh/hst05/IN/no
zip warning: name not matched: dic/page340-1.html
zip warning: name not matched: /export/home/dalvorad/Liv
zip warning: name not matched: files
zip warning: name not matched: to
zip warning: name not matched: convert/sh/hst05/IN/no
zip warning: name not matched: dic/page340-2.html
zip warning: name not matched: /export/home/dalvorad/Liv
zip warning: name not matched: files
zip warning: name not matched: to
zip warning: name not matched: convert/sh/hst05/IN/no

to list a few.  Assuming I can't rename the files I'm looking for, how
could I improve/rewrite the above statement?

Thanks, - Dave





[ Post a follow-up to this message ]



    Re: How can I add filesnames with spaces to my zip archive?  
Stephane CHAZELAS


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-04-04 11:01 PM

2004-10-4, 07:29(-07), D. Alvarado:
> Hello,
>    I am running Solaris 8 and using ksh.  I am trying to add some html
> files to an existing zip archive.  The problem is, some of the zip
> files contain spaces in the file name.  So when I try
>
> find "$filename" -name "*.html" | xargs zip -r "$basename.zip"
[...]

/usr/xpg4/bin/find "$filename" -name "*.html" \
-exec zip -r "$basename.zip" {} +

--
Stephane





[ Post a follow-up to this message ]



    Re: How can I add filesnames with spaces to my zip archive?  
Stephen Riehm


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-04-04 11:01 PM

D. Alvarado wrote:
> Hello,
>    I am running Solaris 8 and using ksh.  I am trying to add some html
> files to an existing zip archive.  The problem is, some of the zip
> files contain spaces in the file name.  So when I try
>
> find "$filename" -name "*.html" | xargs zip -r "$basename.zip"

I'm not sure if this was implemented in solaris 8 (I've only got access
to solaris 9 - and this feature is available there), but have a look for
find ... -print0 and xargs -0 (zero). These print and parse the file
names null-terminated, so spaces are no longer an issue. (An old GNU
feature which has been in most mainstream uni*s for quite a while now).
To use your example:

find "$filename" -name \*.html -print0 | xargs -0 zip -r "$basename.zip"

($filename should of course be a $directory, but you knew that right? ;-)

Good luck,

Steve





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:22 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register