UnZipFile.ReadToFile
--------------------

Reads file from archive and writes it to a new file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Compression](component_Compression.md) | [3.4](newinversion34.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "UnZipFile.ReadToFile"; Index; Path ) 

**MBS**( **"UnZipFile.ReadToFile";** /\* Reads file from archive and writes it to a new file. \*/  
**$Index**; /\* Index of the item from 0 to [UnZipFile.ItemCount](UnZipFileItemCount.md)-1. \*/   
**$Path**) /\* The native file path to the file to write from the archive. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Index | Index of the item from 0 to [UnZipFile.ItemCount](UnZipFileItemCount.md)-1. | $index |
| Path | The native file path to the file to write from the archive. | $path |

### Result

Returns OK on success.

### Description

Reads file from archive and writes it to a new file.  
If you want to decrypt an encrypted file, please use [UnZipFile.UsePassword](UnZipFileUsePassword.md) before calling this function.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### See also

- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [UnZipFile.ItemCount](UnZipFileItemCount.md)
- [UnZipFile.UsePassword](UnZipFileUsePassword.md)
- [ZipFile.UsePassword](ZipFileUsePassword.md)

### Example Databases

- [Archives/Show Zip File Content](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Archives/Show%20Zip%20File%20Content.shtml#6ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 5.3pr1](https://www.mbsplugins.de/archive/2015-08-26/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.2pr1](https://www.mbsplugins.de/archive/2014-04-02/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 26th February 2015

  
[UnZipFile.ReadAsText](UnZipFileReadAsText.md) - [UnZipFile.UsePassword](UnZipFileUsePassword.md)

[HTML Version](UnZipFileReadToFile.shtml)