zip problem

Discussion in 'Mac Basics and Help' started by John Greer, Aug 23, 2011.

  1. John Greer macrumors member

    John Greer

    Joined:
    Jun 20, 2011
    Location:
    Wayne, NJ USA
    #1
    I'm new to Apple (converted in June, from decades of PC).
    I want to archive my MS Office backup files.
    I had no trouble doing it on my PC, but I'm having trouble converting the command to run on my Mac.
    I have it running (made it executable), but it's not finding my files.

    When I run:
    Code:
    #!/bin/bash
    zip -m -r -o -9 -dc -dd  /Volumes/Backup2048/Word /Volumes/*.wbk "/Volumes/Backup of*.docx" 
    I get these messages:
    zip warning: name not matched: /Volumes/*.wbk
    zip warning: name not matched: /Volumes/Backup of*.docx

    btw - Backup2048 is my USB backup drive and HDD2048 is my internal drive.

    HELP!
     
  2. r0k, Aug 23, 2011
    Last edited: Aug 23, 2011

    r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #2
    When I first came from DOS to Unix, I did things in steps.

    First you need a list of all the files you need backed up.

    Try

    ls /Volumes/Backup2048/Word /Volumes/*.wbk

    This should give you the list of files you want.

    The next thing to do is look at the man page for zip.

    Another place to read is Unix for DOS users here.

    The UNIX shell is a lot more powerful than the DOS shell and you can't issue a DOS command in the UNIX shell and get the same results. For instance, when the shell sees *, it gets expanded in place, right there in your command line, to a list of every file in the current folder, before the shell even looks at the next word you typed after * to see what you wanted to do. There is an example given in the zip man page that uses find. Find produces predictable results.

    Try

    find . -name "*.wbk" -print

    You get a listing of all the wbk files in your current folder and all folders beneath your current folder.

    Also blanks are death. How does the shell know you are done saying one thing and ready to say something else? A blank. There are blanks all over the place on OS X and Windows folders but when I'm trying to set up folders to use with bash shell commands, I avoid using blanks. I either use underscores like my_photos or if I can't avoid blanks, I use "\ " backslash blank to let the shell know the blank is not a delimiter but just another character in the string I'm typing.



    hope this helps
     
  3. John Greer thread starter macrumors member

    John Greer

    Joined:
    Jun 20, 2011
    Location:
    Wayne, NJ USA
    #3
    Hmmm, it didn't.
    I guess that's my problem.
    I'l post back when I figure it out...
     
  4. John Greer, Aug 23, 2011
    Last edited: Aug 23, 2011

    John Greer thread starter macrumors member

    John Greer

    Joined:
    Jun 20, 2011
    Location:
    Wayne, NJ USA
    #4
    :confused:

    If I say
    ls -G -h -k -R /Volume/Backup*.docx
    it returns
    ls: /Volume/Backup*.docx: No such file or directory
    yet if I drill down to the directory that contains the files, the LS command works. It's almost as if the -R switch is not working for this command. -R works for other files. Strange...

    ls -G -h -k -R : /Volume/Backup*
    also returns nothing.
     

Share This Page