如何在C#中流式传输整个文件夹? [英] How do I stream an entire folder in C#?

查看:269
本文介绍了如何在C#中流式传输整个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将多个文件传输到没有大量存储空间的目标。压缩是不可能的,所以我需要将多个文件和文件夹作为一个单元转移,不需要解压缩。



我想知道我是否可以流式传输文件夹?



我的尝试:



我目前将多个文件压缩为单个文件,然后传输压缩文件。这没有用,因为目标没有足够的存储空间来存储zip和解压缩的内容。

I need to transfer multiple files to a destination that does not have a lot of storage space. Zipping is out of the question so I need to transfer multiple files and folders as a single unit that does not require unzipping.

I'm wondering if I can stream a folder?

What I have tried:

I'm currently zipping multiple files into a single file and then transferring the zipped file. This is not working out because the destination does not have enough storage all the time to store both the zip and the unzipped contents.

推荐答案

只需迭代源文件夹并复制一次一个文件。它真的很简单。当然,你必须首先确保目标路径存在,但实际上,这是次要的文件系统。
Just iterate the source folder and copy one file at a time. It really is that simple. Of course, you have to make sure the target path exists first, but really, this is minor file system stuff.


这篇关于如何在C#中流式传输整个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆