Fix-OneDrive-Zip icon indicating copy to clipboard operation
Fix-OneDrive-Zip copied to clipboard

How to Run on Mac?

Open xigwon opened this issue 2 years ago • 7 comments

Hello, I am sort of new to using Terminal. How do I get this running on my Mac? I tried "fix-onedrive-zip [filename]" and it said "command not found".

xigwon avatar Mar 29 '22 16:03 xigwon

Hey @xigwon

To run the fix-onedrive-zip script, you need to have perl installed on you system. Run perl -v in your terminal window to check. You should get something like this

$ perl -v

This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-gnu-thread-multi
(with 47 registered patches, see perl -V for more detail)

Copyright 1987-2021, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

If that didn't work you need to install perl.

Assuming you do have perl installed, try running perl fix-onedrive-zip yourzipfile.zip

pmqs avatar Mar 30 '22 07:03 pmqs

Thank you @pmqs , I have perl (5.18.4) installed, but when I tried perl fix-onedrive-zip zipfilename.zip it said "Can't open perl script "fix-onedrive-zip": No such file or directory". Do you know how to fix this? Thanks again.

xigwon avatar Mar 31 '22 00:03 xigwon

Hey @xigwon

I'll keep this as simple as possible

  1. before you start, make sure that the fix-onedrive-zip script and the zip file you want fixed are in the same folder. Let's say it is /Users/xigwon/zip. I don't have a Mac, but I believe Finder is the application for to use.
  2. then in the terminal window run cd /Users/xigwon/zip (replace the path with the location you have actually used)
  3. now try running perl fix-onedrive-zip yourzipfile.zip

pmqs avatar Mar 31 '22 07:03 pmqs

Hi @pmqs! So glad I found this, I signed up to GitHub :) Needless to say i'm nothing of a coder. So I have another question regarding execution of the script on mac : I think I did everything right, downloaded the script, saved it in the same folder as my zip file, made sure I have perl installed, selected the right folder in the console, ran the script and got the error "Error: bad offset 0x3A19A19 at end of 'OneDrive_H.zip'". Is my file beyond hope? Thanks :)

Capture d’écran 2022-08-30 à 18 15 45 Capture d’écran 2022-08-30 à 18 31 22

hanae-ngn avatar Aug 30 '22 16:08 hanae-ngn

Hi @hanae-ngn

the error you are getting suggests that you don't have a OneDrive zip file with the error that my script is designed to fix, but it could be a variation on a OneDrive zip file that I haven't seen before.

Can you show the output you get when you try to unzip OneDrive_H.zip? I need to see what the error message you are getting.

To check this further, could you run zipdetails against the file & include the results. This will output all the metadata present in the zip file and give me a clearer picture about the internal structure of your zip file.

Usage is

perl zipdetails -v --redact OneDrive_H.zip

The redact option will obscure the filenames output, if that is a concern for you.

The zipdetails script has the potential to output a LOT of data. If that is the case and there is too much data to upload, I only really need to see the end of the output. Something like this should get enough for my purposes.

perl zipdetails -v --redact OneDrive_H.zip | tail -n 100

FYI, this is is an example section at the end of the zipdetails output that I want to see.

00BF 0004 50 4B 06 06 ZIP64 END CENTRAL DIR 06064B50
                      RECORD
00C3 0008 2C 00 00 00 Size of record        000000000000002C
          00 00 00 00
00CB 0001 1E          Created Zip Spec      1E '3.0'
00CC 0001 03          Created OS            03 'Unix'
00CD 0001 2D          Extract Zip Spec      2D '4.5'
00CE 0001 00          Extract OS            00 'MS-DOS'
00CF 0004 00 00 00 00 Number of this disk   00000000
00D3 0004 00 00 00 00 Central Dir Disk no   00000000
00D7 0008 01 00 00 00 Entries in this disk  0000000000000001
          00 00 00 00
00DF 0008 01 00 00 00 Total Entries         0000000000000001
          00 00 00 00
00E7 0008 5A 00 00 00 Size of Central Dir   000000000000005A
          00 00 00 00
00EF 0008 65 00 00 00 Offset to Central dir 0000000000000065
          00 00 00 00

00F7 0004 50 4B 06 07 ZIP64 END CENTRAL DIR 07064B50
                      LOCATOR
00FB 0004 00 00 00 00 Central Dir Disk no   00000000
00FF 0008 BF 00 00 00 Offset to Central dir 00000000000000BF
          00 00 00 00
0107 0004 00 00 00 00 Total no of Disks     00000000

010B 0004 50 4B 05 06 END CENTRAL HEADER    06054B50
010F 0002 00 00       Number of this disk   0000
0111 0002 00 00       Central Dir Disk no   0000
0113 0002 01 00       Entries in this disk  0001
0115 0002 01 00       Total Entries         0001
0117 0004 5A 00 00 00 Size of Central Dir   0000005A
011B 0004 FF FF FF FF Offset to Central Dir FFFFFFFF
011F 0002 00 00       Comment Length        0000
Done

pmqs avatar Aug 30 '22 18:08 pmqs

Thanks so much for your reply and details @pmqs! The message I get when I try to extract the file is "Cannot open file 'OneDrive_H.zip'. It does not appear to be a valid archive." (screenshot included)

When I run perl zipdetails -v --redact OneDrive_H.zip, I get a very small output which kinda worries me.

Should mention that this is a file I downloaded and saved on a GDrive from one Mac, then downloaded from GDrive on another Mac, I feel that has potential to mess things up?

Capture d’écran 2022-08-30 à 20 42 54 Capture d’écran 2022-08-30 à 20 47 15

hanae-ngn avatar Aug 30 '22 19:08 hanae-ngn

@hanae-ngn

try running zipdetails with the --scan option. Note that it may take a long time to run

perl zipdetails -v --redact --scan OneDrive_H.zip

pmqs avatar Aug 30 '22 19:08 pmqs