Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Page 1 of 2 12 LastLast
Results 1 to 8 of 9
  1. #1
    DmaxGuy is offline Registered User
    Join Date
    May 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Can I batch .tar or .gzip from the terminal? HELP!!



    I work at a prepress company and I need the capability to be able to batch .tar or .gzip files from the command line.

    When we archive files on Retrospect for WinDoze [can't change to Mac for this unfortunately], fonts are never archived because Retrospect for WinDoze doesn't copy the Mac resources.

    When I get ready to archive jobs on our server, they're dragged to a folder called "Jobs_ToBeArchived". Inside this folder are hundreds of job folders with names like "1234_AdidasAd" or "2345_JoeBoxer". Inside these job folders contain a hierarchy of folders containing various parts of the job. "01_Layout", "02_PlacedFiles", "03_Fonts", "04_EPS" and so on.

    What I need is a command line script that will find every instance of "03_Fonts" inside of "Jobs_ToBeArchived"; compress it to a .tar or .gzip file; leave the compressed file it in the same directory as the source, and if possible discard the original folder after it's compressed.

    Any help would be greatly appreciated!

    TIA,
    Bob

  2. #2
    scruffy's Avatar
    scruffy is offline Notorious Olive Counter
    Join Date
    Dec 2000
    Location
    Soviet Canuckistan
    Posts
    1,726
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't think that tar will keep the resource forks either.

    There is a modified version of tar that preserves hfs resource forks, you can find it here:
    http://www.metaobject.com/Products.html
    You might want to give that a try.

    As for the script, here's a first shot at one, using hfstar:

    cd Jobs_ToBeArchived
    find . -name 03_Fonts -print0 | xargs -0 hfstar -uf foo.tar

    which will find all the folders named 03_Fonts and make an hfstar archive out of them in the root level of Jobs_ToBeArchived. To recover them, just cd to Jobs_ToBeArchived again, and:
    hfstar -xf foo.tar

    What is the robbing of a bank compared to the founding of a bank?
    -- Bertold Brecht

  3. #3
    scruffy's Avatar
    scruffy is offline Notorious Olive Counter
    Join Date
    Dec 2000
    Location
    Soviet Canuckistan
    Posts
    1,726
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh - I guess the -print0 an -0 stuff isn't necessary if the folders will always have really simple names. That just lets you check for folders that have spaces and other goofy stuff in their names.

    What is the robbing of a bank compared to the founding of a bank?
    -- Bertold Brecht

  4. #4
    DmaxGuy is offline Registered User
    Join Date
    May 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Thanks!

    I'll give this a try and let you know.

    I appreciate your help!


  5. #5
    DmaxGuy is offline Registered User
    Join Date
    May 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Here's what I get...

    [FTPMacintosh:admin/Desktop/Fonts Test] admin# find . -name 03_Fonts -print0 | xargs -0 hfstar -uf foo.tar
    xargs: hfstar: Permission denied

    Hmmm... I'm logged in as root...

    Any ideas?

    Thanks!

  6. #6
    podmate is offline Registered User
    Join Date
    Dec 2002
    Location
    Little Rock, Ar.
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try:
    sudo find . -name 03_Fonts -print0 | xargs -0 hfstar -uf foo.tar

    enter your password when prompted.

    Even though you are logged in as root (unless you have enabled the root user account in OS X) you will still need to use sudo for some things.
    Never ask a man what computer he uses. If it's a Mac, he'll tell you. If it's not, why embarrass him?

  7. #7
    brianleahy's Avatar
    brianleahy is offline Colonel Panic
    Join Date
    Sep 2000
    Location
    Northern Ohio
    Posts
    1,588
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm. What happens to the resource forks if you format your HD as UFS?

    Or - if you copy files from an HFS+ to a UFS partition?
    OS X 10.8.2
    MacPro 4-core 2.9Ghz
    Apple 23" Cinema Display

  8. #8
    scruffy's Avatar
    scruffy is offline Notorious Olive Counter
    Join Date
    Dec 2000
    Location
    Soviet Canuckistan
    Posts
    1,726
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could it be that hfstar just doesn't have the execute permission bit set? (Try 'chmod a+x /path/to/hfstar')

    brianleahy - examining the contents of the tar archives hfstar makes, you can see that the resource fork is just saved as a separate file with a specific name. So, if you have a file 'file' with a resource fork, the tar archive will contain files called 'file' (the data fork) and '._file' (the resource fork).

    I think I remember reading OS X does something similar with UFS volumes, or any where file systems where resource forks aren't available; maybe not exactly the same naming convention, but the same idea. Never tried it though...

    What is the robbing of a bank compared to the founding of a bank?
    -- Bertold Brecht

 

 
Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •