如何将我的文件从一个文件夹复制到应用程序中的另一个文件夹 [英] How copy my files one folder to antoher in application
本文介绍了如何将我的文件从一个文件夹复制到应用程序中的另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我的应用程序有两个文件夹,我想在树中复制选定的文件,然后将文件复制到目标文件夹,您可以引导或发送任何代码段吗?
hello,
I my application i have two folders i want to copy selected file in tree the file copied into target folder , can u guide or send any snippets
推荐答案
查看 File.Copy方法 [ BackgroundWorker [ ^ ]线程可以防止您执行此操作用户界面正在被复制操作锁定.
Look at the File.Copy method[^] it only does them one at a time, but that''s just a loop for multiple files.
It might be worth you also looking at using a BackgroundWorker[^] thread to do this to prevent you UI getting locked with the copy operation is in progress.
对于代码段而言,它太简单了.您只需要方法System.IO.File.Copy
:
http://msdn.microsoft.com/en-us/library/system. io.file.copy.aspx [ ^ ].
另请参见:
http://msdn.microsoft.com/en-us/library/cc148994.aspx [ ^ ].
我认为,这绰绰有余.
-SA
It''s too simple for a snippet. All you need is the methodSystem.IO.File.Copy
:
http://msdn.microsoft.com/en-us/library/system.io.file.copy.aspx[^].
See also:
http://msdn.microsoft.com/en-us/library/cc148994.aspx[^].
I think, this is even more than enough.
—SA
如果要将文件从任何地方复制到任何地方,
使用像这样的File.Copy方法
if you want to copy a file from anywhere to anywhere
use File.Copy method like this
File.Copy("C:/file_source/file_name", "D:/file_dest/file_name");
这篇关于如何将我的文件从一个文件夹复制到应用程序中的另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文