如何创建一个递归函数来复制所有文件和文件夹 [英] How to create a recursive function to copy all files and folders

查看:174
本文介绍了如何创建一个递归函数来复制所有文件和文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个递归复制源文件夹和所有文件和文件夹它内部不同位置的功能。

I am trying to create a function that will recursively copy a source folder and all files and folders inside of it to a different location.

目前,我的主要文件夹,这是使code臃肿冗余中定义的每个文件夹。

At the moment, I have to define each folder within the main folder, which is making the code bloated and redundant.

什么是这样做的更有效的方法?

What's a more efficient way of doing this?

推荐答案

MSDN有一个例子:如何:复制目录

MSDN has an example: How to: Copy Directories.

这篇关于如何创建一个递归函数来复制所有文件和文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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