{"id":19957542,"url":"https://github.com/pmqs/fix-onedrive-zip","last_synced_at":"2025-04-07T07:00:22.660Z","repository":{"id":65586722,"uuid":"268172727","full_name":"pmqs/Fix-OneDrive-Zip","owner":"pmqs","description":"Fix OneDrive Zip files \u003e4Gig","archived":false,"fork":false,"pushed_at":"2025-03-21T11:16:40.000Z","size":154,"stargazers_count":294,"open_issues_count":0,"forks_count":26,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T06:05:30.532Z","etag":null,"topics":["large-files","onedrive","onedrive-zip","right-click","unzip","unzip-files","unzipping-files","windows-compressed-folder","zip","zip-archive","zip-file","zip64"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmqs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-30T22:54:21.000Z","updated_at":"2025-03-28T19:18:56.000Z","dependencies_parsed_at":"2024-04-27T14:27:11.120Z","dependency_job_id":"772b04fb-0946-40e5-ac13-27a005106050","html_url":"https://github.com/pmqs/Fix-OneDrive-Zip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmqs%2FFix-OneDrive-Zip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmqs%2FFix-OneDrive-Zip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmqs%2FFix-OneDrive-Zip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmqs%2FFix-OneDrive-Zip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmqs","download_url":"https://codeload.github.com/pmqs/Fix-OneDrive-Zip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608150,"owners_count":20965952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["large-files","onedrive","onedrive-zip","right-click","unzip","unzip-files","unzipping-files","windows-compressed-folder","zip","zip-archive","zip-file","zip64"],"created_at":"2024-11-13T01:38:11.285Z","updated_at":"2025-04-07T07:00:22.616Z","avatar_url":"https://github.com/pmqs.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fix-OneDrive-Zip\n\n[![Linux build](https://github.com/pmqs/Fix-OneDrive-Zip/workflows/Linux%20build/badge.svg)](https://github.com/pmqs/Fix-OneDrive-Zip/actions)\n[![MacOS build](https://github.com/pmqs/Fix-OneDrive-Zip/workflows/Macos%20build/badge.svg)](https://github.com/pmqs/Fix-OneDrive-Zip/actions)\n[![Windows build](https://github.com/pmqs/Fix-OneDrive-Zip/workflows/Windows%20build/badge.svg)](https://github.com/pmqs/Fix-OneDrive-Zip/actions)\n[![FreeBSD](https://api.cirrus-ci.com/github/pmqs/Fix-OneDrive-Zip.svg?task=FreeBSD)](https://cirrus-ci.com/github/pmqs/Fix-OneDrive-Zip?task=FreeBSD)\n\nThis program fixes an issue with Zip files larger than 4 Gig that have been created by either\n`OneDrive` or  the Windows 10 right-click action \"`Send-To/Compressed\n(zip) folder`\". At the time of writing these Zip files cannot be unzipped\nusing some of the well-know Zip archivers.\n\nFor a really detailed summary of the issue, see\n[Does Microsoft OneDrive export large ZIP files that are corrupt?](https://www.bitsgalore.org/2020/03/11/does-microsoft-onedrive-export-large-ZIP-files-that-are-corrupt).\n\nThis program automates the manual process described in the referenced page.\nIt has been tested on Windows, Linux, MacOS \u0026 FreeBSD.\n\n\u003e [!NOTE]\n\u003e\n\u003e 1. It may be possible to work around this issue by updating the archiving program you are using to the latest version. No guarantees.\n\u003e\n\u003e 2. It is strongly recommended to take a backup copy of your original zip file before running this program.\n\u003e\n\u003e 3. You need a 64-bit build of `Perl` installed on your system to run this program.\n\u003e\n\n## Usage\n\n    perl fix-onedrive-zip [--dry-run] file1.zip [file2.zip...]\n\nThe `--dry-run` option will simulate running of the program without making\nany changes to the Zip file.\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003ch2\u003eNotes for Windows Users\u003c/h2\u003e\u003c/summary\u003e\n\nIf you are running Windows and don't know what a Perl script is, or how to run one, this section\nwill walk you through the process.\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cb\u003eStep 1: Check if you already have Perl installed\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nThe `fix-onedrive-zip` script is written in `Perl`. To run it on your PC you need to have\nthe `perl` executable installed.\n\nTo check if it is already installed, create a terminal window by typing `Windows+R`.\nIn the pop-up window type `cmd`. You should now have a terminal window open.\n\nType `perl -v`.\nIf `perl` is installed you should see text like this. The Perl version doesn't matter.\n\n```\nC:\\Users\\me\u003eperl -v\n\nThis is perl 5, version 32, subversion 1 (v5.32.1) built for MSWin32-x64-multi-thread\n\nCopyright 1987-2021, Larry Wall\n\nPerl may be copied only under the terms of either the Artistic License or the\nGNU General Public License, which may be found in the Perl 5 source kit.\n\nComplete documentation for Perl, including FAQ lists, should be found on\nthis system using \"man perl\" or \"perldoc perl\".  If you have access to the\nInternet, point your browser at http://www.perl.org/, the Perl Home Page.\n```\n\nIf you don't have `perl`, the output will look like this\n\n```\n'perl' is not recognized as an internal or external command,\noperable program or batch file.\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cb\u003eStep 2: Install Perl if you don't already have it\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nThere are a number of Perl executables available for Windows.\nFor this tutorial I've used [Strawberry Perl](https://strawberryperl.com/), but there are others available.\n\nUse the instructions [here](https://www.perltutorial.org/setting-up-perl-development-environment/) to install the 64-bit \"*Recommended version*\" of `perl` from the [Strawberry Perl](https://strawberryperl.com/) site.\n\nOnce the installation is complete, run `Step 1`, above, to double-check that the perl works ok\nfrom the command-line in a terminal window.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cb\u003eStep 3: Download the fix-onedrive-zip script\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nYou now need to get the `fix-onedrive-zip` script downloaded from GitHub and stored on your PC. In a browser navigate to\n[here](https://github.com/pmqs/Fix-OneDrive-Zip/blob/master/fix-onedrive-zip) and\nselect the \"`Download raw file`\" icon, as highlighted below\n\n![](assets/download.png)\n\nThat should download the file `fix-onedrive-zip` into your `Downloads` directory.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e \u003cb\u003eStep 4: Running the fix-onedrive-zip script\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nThe easiest approach to running this script if you are not confortable with running from the command-line is to\nput the `fix-onedrive-zip` script and the zip file you want to fix in the same folder. Lets assume you have both stored in the folder `C:\\fixzip` and the name of the OneDrive zip file you want to fix is `myfile.zip`.\n\nStart by creating a terminal window by typing `Windows+R` and typing `cmd` in the pop-up window.\n\nNow run the command below in the terminal window to move to the folder where your zip file is stored, replacing\n`C:\\fixzip` with the name of the folder you are using\n\n```\ncd C:\\fixzip\n```\n\nYou can now run the `fix-onedrive-zip` script by typing this in the terminal window. Remember to change `myfile.zip` to the name of the zip file you want fixed.\n\n```\nperl fix-onedrive-zip myfile.zip\n```\n\nThat should have fixed your zip file.\n\u003c/details\u003e\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch2\u003eWhat if this program does not fix the issue?\u003c/h2\u003e\u003c/summary\u003e\n\n\nThe most common issue reported with this script is the following error\nmessage:\n\n```Error: Cannot find Zip signature at end of 'somefile.zip'```\n\nTo understand what this message means you first need to know a little bit\nabout the structure of the metadata in a zip file.\n\nAt the start of a zip file\nthere are 4 bytes called the \"`local file header signature`\". The majority of metedata values in a zip file are stored in little-endian byte order, so these 4 bytes are unpacked as the litte-endian value `0x04034b50`. For this error case these 4\nsignature bytes *will* be present, so the script knows it likely dealing\nwith a zip file.\n\nOnce that initial test is done, the script moves to 22 bytes before the end\nof the file and checks that the 4 bytes of the \"`end of central dir\nsignature`\" (little-endian value `0x06054b50`) are present.  In this case\nit *doesn't* find these signature bytes.\n\nThis program can only work with a well-formed zip file, so it now terminates immediately with the error message shown above.\n\nThe root-cause for this error is typically a zip file that has either been truncated or partially corrupted (i.e. the end the file has been overwritten with random data).\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003eStrategies for recovering data\u003c/h3\u003e\u003c/summary\u003e\n\n\nThe most straightforward way to deal with a truncated/corrupt zip file is to download a fresh copy of the zip file.\n\nIf downloading is not an option, it may be possible to recover some/all of the zip file payload data. It just depends on how badly damaged the file is. Be aware - if payload data has been overwritten or is absent there is no way that to retrieve this data from the zip file.\n\nThere are plenty of articles available online that discuss recovering data from corrupt zip files, so I'll only mention that the  [Info-ZIP](https://infozip.sourceforge.net/) implementaion of `zip` (most Unix/Mac systems ship with this program) has two commandline options,  `-F` and `-FF`,  that can be used to attempt to fix zip files.\n\n\u003c/details\u003e\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch2\u003eZip File Technical Details\u003c/h2\u003e\u003c/summary\u003e\n\nIf you want to understand more about the internal structure of Zip files,\nthe primary reference is\n[APPNOTE.TXT](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT).\n\nThe issue with `OneNote`/`Windows` Zip files larger than 4 Gig is they\nhave an invalid `Total Number of Disks` field in the\n`ZIP64 End Central Directory Locator` record (see [APPNOTE.TXT](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) version 6.3.10, section 4.3.15).\nThe value in this field should be `1`, but `OneDrive`/`Windows` incorrectly sets it to `0`.\n\nThis program simply changes the `Total Number of Disks` field value to `1`\nif it finds it set to `0` in a Zip file.\n\n\u003c/details\u003e\n\n## Support\n\nIf you have any problem running this program, or have suggestions or questions,\nplease report them at https://github.com/pmqs/Fix-OneDrive-Zip/issues.\n\n## Copyright\n\nCopyright (c) 2020-2025 Paul Marquess (pmqs@cpan.org). All rights reserved.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmqs%2Ffix-onedrive-zip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmqs%2Ffix-onedrive-zip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmqs%2Ffix-onedrive-zip/lists"}