How to zip an Azure share folder, save the Zip to the original folder location and delete the original folder

C# Amateur 1 Reputation point
2023-10-04T09:15:58.8566667+00:00

I have a project where I am trying to zip a sample Azure Share folder then delete the folder I zipped from share and then leave the Zip in the same location where the folder was. I tried using a download the folder first to offline, then zip it while offline and and then re upload the zipped file to Share but some folders are pretty big up to 15 Gigs and may throw an exception on machines running out of disk space. Is there a way I can use memory stream to directly read the folder into a zipfile stream as I upload to share? Thanks

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,770 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bhanu Ejjagiri 261 Reputation points Microsoft Employee
    2023-10-05T19:14:40.6433333+00:00

    Hi C# Amateur

    Thanks for reaching Microsoft Q&A team.

    If you are using Azure file share, you can mound the file share to your local machine to access the files inside the fileshare as if you are accessing your local machine files.

    If you are using a Windows machine, please mount the Azure file share (Assuming Z drive) --> go to Z:\ drive --> right click on the file and "Send to" --> Compressed (Zipped) folder.

    This will create a new zipped file, with in the mount drive without needing to download the file and upload and quicker process, and you can delete the original file later.

    Please let me know if misunderstood your requirements.

    And if this answers your question, please mark it as an answer.

    Thanks!