如何将文件夹更改为文件c#win。形成 [英] How to change folder to file c# win. form

查看:79
本文介绍了如何将文件夹更改为文件c#win。形成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用第三方软件的情况下将文件夹更改为文件,并在c#win中使用dll。表格?



[注意:只需要将文件夹转换为文件,根本不需要压缩]



提前感谢

How to change folder to file without using third party software and dll's in c# win. form?

[Note:Just want conversion of folder to file no compression at all is needed]

Thanks in advance

推荐答案

在扫描所有文件时将文件名和大小保存在单独的文件中。然后将文件数量和这个信息文件添加到附加文件的顶部。



这只是一个脱离我的头脑的想法,但最重要的是只保存将文件恢复为同一文件中的标题所需的任何信息。
as you scan through all the files save the file name and size in a separate file. then add the number of files, and this file of information to the top of the appended files.

This is just a "off the top of my head" idea, but the main thing is just save whatever information you need to restore the files as a header in the same file.


我认为你的意思是如何复制文件夹中的所有文件一个大文件。



打开你要附加所有内容的文件。

使用Directory.GetFiles之类的东西获取所有名称文件夹中的文件。

对于每个文件,打开它并将整个内容附加到主附加文件。

然后对于当前文件夹中的每个文件夹,重复上述过程。



一般来说,递归用于遍历所有子文件夹。





C#FileSearch [ ^ ]



为使用c#递归的示例文件夹结构。
I think you mean "how do a I copy all the files in a folder to one big file".

Open the file you want append everything to.
Use something like Directory.GetFiles to get all the names of the files in the folder.
For each file, open it and append the whole thing to your main append file.
Then for each folder in the current folder, repeat the above process.

Generally, recursion is used to go through all the sub-folders.

see
C# FileSearch[^]

for an example of using c# to recurse through a folder structure.


这篇关于如何将文件夹更改为文件c#win。形成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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