1. Attachments are working again! Check out this thread for more details and to report any other bugs.

OSX Linux archive question (puzzled!)

Discussion in 'Fred's House of Pancakes' started by daniel, Mar 22, 2009.

  1. daniel

    daniel Cat Lovers Against the Bomb

    Joined:
    Feb 25, 2004
    14,487
    1,518
    0
    Location:
    Spokane, WA
    Vehicle:
    2004 Prius
    Getting my new Linux Asus Eee PC 900 ready for my upcoming trip, I want to carry a bunch of pictures on it. Memory is very limited, so I figured I'd zip the pictures. Since I've been unable to get tar to work (I cannot figure out the syntax) I just used the Mac's archive utility to zip my pictures. On the Mac I can zip and unzip them and everything looks normal.

    But when I unzip the archive on the Eee, I get all my pictures, but in addition I get a subdirectory called "__MACOSX" and in that subdirectory are a bunch of files with the names of some (not all!) of my pictures, but with "._" prepended. So if one of my pictures is titled "IMG_0546.jpg" there will be a file in the __MACOSX directory named "._IMG_0546.jpg"

    Not all of my original files are mirrored this way, but all the mirrored files have names built from names of my pictures. Ie, there are fewer files in the subdirectory than in the main one.

    I tried copying the pictures to a different directory and zipping them from there, but the result was the same.

    I solved the problem by just copying the pictures themselves over to the Eee and using the Eee's own zip utility (which was easier to figure out than tar). But I'm very curious about what are all these files on my Mac that don't show up there, but do show up when an archive is opened on the Linux box.
     
  2. JasonS

    JasonS Jason Siegel

    Joined:
    Dec 20, 2003
    53
    0
    0
    Vehicle:
    2004 Prius
    This is probably Mac's way of saving thumbnails and/or additional data for its own use. The files are invisible in Mac and shouldn't be useable on Linux anyway so you can just delete them.
     
  3. daniel

    daniel Cat Lovers Against the Bomb

    Joined:
    Feb 25, 2004
    14,487
    1,518
    0
    Location:
    Spokane, WA
    Vehicle:
    2004 Prius
    Then why are only some of the actual pictures represented in the mirrored file names?

    And why, when I specifically select a list of files for inclusion in a zip file, does the archiving program include a bunch of other files, which I had not selected, in the archive?

    Having no tools available that I know of for deleting files in an archive, I ended up having to do it the long way: copying the pictures over to the Linux box via a usb memory stick, and archiving them there (once I found a program I was able to do that with.)
     
  4. JasonS

    JasonS Jason Siegel

    Joined:
    Dec 20, 2003
    53
    0
    0
    Vehicle:
    2004 Prius
    See this URL:
    Whats with __MACOSX in Zip files? | Floating Sun

    The pictures you're referring to are probably the thumbnails, which Mac uses to speed up the processing of its GUI. Mac tries to automate some processes for users so that they don't need to select options all the time. The downside of this is that certain phenomena—like this—are executed without your knowledge.

    I can't tell you how to fix the "problem," but at least you can now understand what's happening.
     
  5. daniel

    daniel Cat Lovers Against the Bomb

    Joined:
    Feb 25, 2004
    14,487
    1,518
    0
    Location:
    Spokane, WA
    Vehicle:
    2004 Prius
    Thanks for that info. I agree with the author that it's bad for it to be doing that. But at least I understand what's going on, and I know that I have to use zip from a terminal rather than the context menu from the finder, to make a clean archive. Or, as I did end up doing, make the archive on the Linux box.
     
  6. jayman

    jayman Senior Member

    Joined:
    Oct 21, 2004
    13,439
    639
    0
    Location:
    Winnipeg Manitoba
    Vehicle:
    2004 Prius
    Mac OSX does a good job of hiding various hidden processes and actions from the user, as it should. However when you copied the photos, the hidden files were also copied and displayed

    Like with Windows when you enable viewing of hidden and system files/folders. There are many odd files, eg "Thumbs.db" that if fiddled with by a casual user, would cause problems

    Of course, if you *really* want problems with Windows, copy an entire folder, put it on a second drive of another Windows machine, and suddenly you don't have "ownership" and access is denied.

    This doesn't make Windows any more "secure" - HA! A joke! - but does make it a royal PITA to "force" ownership of the new folder/files
     
  7. HTMLSpinnr

    HTMLSpinnr Super Moderator
    Staff Member

    Joined:
    Dec 8, 2003
    5,339
    917
    251
    Location:
    Surprise, AZ (Phoenix)
    Vehicle:
    2018 Tesla Model 3
    Model:
    N/A
    This is only an issue on NTFS formatted drives (which just about all fresh install and OEM XP installations use and all Vista instalations use - unless you've upgraded an upgrade based on FAT32). If copied onto a USB thumb drive of other FAT32 medium first, ownership no longer becomes an issue. Alternatively, make sure you apply recursively "Everyone, Full Control" perms on the target folder once copied from the original machine.

    Daniel, have you tried taring and untaring instead?

    Create:
    Code:
    tar cvfz archive.tar.gz <target directory1> <target directory2>
    Extract:
    Code:
    tar xvfz archive.tar.gz
     
  8. qbee42

    qbee42 My other car is a boat

    Joined:
    Mar 2, 2006
    18,058
    3,073
    7
    Location:
    Northern Michigan
    Vehicle:
    2006 Prius
    I think with Daniel we have tried tarring and feathering. :D

    Tom
     
  9. daniel

    daniel Cat Lovers Against the Bomb

    Joined:
    Feb 25, 2004
    14,487
    1,518
    0
    Location:
    Spokane, WA
    Vehicle:
    2004 Prius
    For some reason, I get nothing but error messages when I try to create an archive with tar. The man pages are very cryptic. And even your example above does not say which is the input and which is the output.

    Is it
    Code:
    tar cvfz archive.tar.gz <input files> <output archive>
    or is it
    Code:
    tar cvfz archive.tar.gz <output archive> <input files>
    I have no problem extracting files from an archive with tar.

    However, my linux box has zip and unzip, which work for me. So I really don't have a problem. (BTW, between tar and zip, which produces the better compaction?) It's just that it would have been easier to create the archive on the Mac and move the archive, rather than having to move all the pictures, and then archive (to save space) on the linux box. It was really mostly a matter of curiosity for me why those added files and directory were being created.

    And then rmdir was refusing to work because there were files in the __MACOSX directory, and it took me a while to figure out that "rm -r" will empty and remove a directory in one shot. (It's been many years since I ran Unix on my 80286!)

    And since I didn't know what was going on, I didn't think of opening a terminal on the Mac and using tar or zip from there. I never do that on the Mac so it didn't occur to me until I didn't need it any more because I'd already done it the "long" way.
     
  10. timberwolf

    timberwolf New Member

    Joined:
    Oct 26, 2008
    220
    31
    0
    Location:
    UK
    Vehicle:
    2008 Prius
    The JPEG file format is already a highly compressed format, you'll only get about 1-2% compression by archiving and compressing those files with either zip, gzip or bzip2 (the latter two are available on GNU tar).

    If your purpose was just to view the JPEGs on the small screen of the EEE PC, it would have been better to process the images using software that can reduce the size e.g. my old digital camera takes images 2272x1704 pixels, for viewing you could use software to process and make copies that are 640x480 pixels, which would result in copies that are roughly a 1/10th the size of original files. These are off the top of my head so I could be a little off on my guessimate.
     
  11. HTMLSpinnr

    HTMLSpinnr Super Moderator
    Staff Member

    Joined:
    Dec 8, 2003
    5,339
    917
    251
    Location:
    Surprise, AZ (Phoenix)
    Vehicle:
    2018 Tesla Model 3
    Model:
    N/A
    Actually it's
    Code:
    tar cvfz <output archive> <input files or directories>
    I used archive.tar.gz as the example output archive name.
     
  12. timberwolf

    timberwolf New Member

    Joined:
    Oct 26, 2008
    220
    31
    0
    Location:
    UK
    Vehicle:
    2008 Prius
    It's pretty pointless trying to compress JPEGs thou...
     
  13. daniel

    daniel Cat Lovers Against the Bomb

    Joined:
    Feb 25, 2004
    14,487
    1,518
    0
    Location:
    Spokane, WA
    Vehicle:
    2004 Prius
    Thanks everyone for all the clarifications. I'll give tar another try just to see if I understand it now.

    I don't know if I'd want to reduce the resolution of the pics, because someone might want copies, and I'd rather give them the full pics. I thought I was saving space by archiving them, but now that I understand I'm not, I'll probably just stick them in a convenient directory. Maybe I'll just carry them on an SD card so they don't take up space in the computer's small solid-state "HD."

    The computer has a card reader, so I can use a memory card, which looks like a removable drive.

    Though memory space shouldn't be a problem. Out of 4 gigs total, I have half a gig free, and I've now got all the software I need on the machine. I upgraded to Firefox 3 (not a trivial task on this box) and I got Shredder Chess, and it came with OpenOffice and some games (solitaire, Penguin Racer, Tux Draw, and a few others). Tux Draw is a drawing program for children, with a lot of useless but silly/fun tools.
     
  14. HTMLSpinnr

    HTMLSpinnr Super Moderator
    Staff Member

    Joined:
    Dec 8, 2003
    5,339
    917
    251
    Location:
    Surprise, AZ (Phoenix)
    Vehicle:
    2018 Tesla Model 3
    Model:
    N/A
    Compression may be pointless, but moving the archive in one piece may not be. Given that you're already consolidating them, compressing 1-2% if you have the time isn't a lost cause.
     
  15. jayman

    jayman Senior Member

    Joined:
    Oct 21, 2004
    13,439
    639
    0
    Location:
    Winnipeg Manitoba
    Vehicle:
    2004 Prius
    I tried to explain that to a client, who for some reason insisted on formatting a USB backup drive to NTFS. I figure if they don't mind paying me, but not listening to me, who am I to complain?
     
  16. jayman

    jayman Senior Member

    Joined:
    Oct 21, 2004
    13,439
    639
    0
    Location:
    Winnipeg Manitoba
    Vehicle:
    2004 Prius
    Daniel

    You know we like you and just tease sometimes ...