Operating System - HP-UX
1748243 Members
4396 Online
108760 Solutions
New Discussion

How to handle metacharacters through zip command

 
SOLVED
Go to solution
allanm77
Frequent Advisor

How to handle metacharacters through zip command

Hi--

 

While zipping a directory, which has few subdirectories having the dollar sign in their names, the zip command fails.

 

How do I fix this issue?

 

Thanks,

Allan

 

13 REPLIES 13
Dennis Handly
Acclaimed Contributor

Re: How to handle metacharacters through zip command

(Why would you want files with "$" in them?  These aren't Unix friendly.)

 

What error do you get?

I'm not sure why zip should care?  The shell only sees the upper directory.

 

I don't know if the "-UN w" option will help?

allanm77
Frequent Advisor

Re: How to handle metacharacters through zip command

Here is the error that I get :-

Error: zip I/O error: No such file or directory. . zip error: Input file read failure
Steven Schweda
Honored Contributor

Re: How to handle metacharacters through zip command

> While zipping a directory, which has few subdirectories having the
> dollar sign in their names, the zip command fails.

   A useful problem report would offer some basic info, like, for
example:

      uname -a

      zip -v

      Actual command used.

      Actual output from the command.

      ls -l[R] <stuff which you were trying to archive>

> Error: zip I/O error: No such file or directory. . zip error: Input
> file read failure

   Many things are possible, but, if this Zip program is even remotely
current, then I would not expect a name with a dollar sign to cause any
particular trouble.  For example, using what I have lying around on a
convenient Mac OS X system:

bash-3.2$ zip3 dollar.zip -r .
  adding: $dir$/ (stored 0%)
  adding: $dir$/$name$ (stored 0%)
  adding: fred$fred (stored 0%)

bash-3.2$ unzip61 -d fred dollar.zip
Archive:  dollar.zip
   creating: fred/$dir$/
 extracting: fred/$dir$/$name$       
 extracting: fred/fred$fred          

bash-3.2$ ls -lR fred
total 8
drwxr-xr-x  3 sms  admin  102 Feb  5 21:39 $dir$
-rw-r--r--  1 sms  admin    5 Feb  5 21:33 fred$fred

fred/$dir$:
total 8
-rw-r--r--  1 sms  admin  5 Feb  5 21:38 $name$

   Zip doesn't care about dollar signs.  Like many programs, it does
care about permissions, so if _you_ can't read a file, then Zip probably
can't read it for you.  But, with approximately no useful information,
and my weak psychic powers, I probably can't guess what the problem is
here.

Laurent Menase
Honored Contributor

Re: How to handle metacharacters through zip command

are you sure the $ is not interpreted by the shell..

 

try  with \$dir\$

 

 

Dennis Handly
Acclaimed Contributor

Re: How to handle metacharacters through zip command

>are you sure the $ is not interpreted by the shell.

 

Allan did say subdirectories.  And I assumed he was using zip -r on the parent directory.

Steven Schweda
Honored Contributor

Re: How to handle metacharacters through zip command

> [...] I assumed he was using zip -r on the parent directory.

 

   _I_ assume that if he really wants an answer, then he'll supply
enough useful information to obviate such assuming and guessing, but so
far I see no evidence of that.

allanm77
Frequent Advisor

Re: How to handle metacharacters through zip command

Yes, am using zip r *

allanm77
Frequent Advisor

Re: How to handle metacharacters through zip command

Will try upgrading the version of zip tomm.
Steven Schweda
Honored Contributor

Re: How to handle metacharacters through zip command

> Yes, am using zip r *

   Still not much useful information.  This new copy+paste technology is
amazing.  You should try it.

> Will try upgrading the version of zip tomm.

   Would it hurt you to provide some useful information, as requested?
Around here, the oldest version I have, "Zip 2.32 (June 19th 2006)"
appears to have no more trouble with my test than the latest released
version, "Zip 3.0 (July 5th 2008)" (or the latest development code,
either).