如何一次将所选文件和文件夹复制到另一个文件夹? [英] How can I copy selected files and folders to another folder in onetime ?

查看:117
本文介绍了如何一次将所选文件和文件夹复制到另一个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想尝试将所选文件和文件夹复制在一起。不复制单个目录或选择文件。



在A主文件夹中有:B,C,D,E子文件夹。

和A主文件夹中有以下文件: file1.docx,File2.pdf,File3.jpg,File4.mp3



如何使用multiselect复制FolderB和File2以及File4 togerher?



有可能吗?



我可以使用openfiledialog复制MultiSElect文件或使用folderbrowsdialog复制文件夹



但我无法做到,无法在互联网上找到。



我尝试了什么:



I just want to try to Copy Selected Files and folders together. Not copy a single Directory or Select Files.

in A main Folder there are : B, C, D, E Subfolders.
and in A Main Folder there are files as : file1.docx, File2.pdf, File3.jpg, File4.mp3

How can I copy FolderB and File2 and File4 togerher with multiselect ?

is it possible ?

I can Coppy MultiSElect Files with openfiledialog or copy folder with folderbrowsdialog

but I couldnt do and couldnt find in internet.

What I have tried:

If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

                Dim sayi As Integer = Me.OpenFileDialog1.FileNames.Length - 1
                For i As Integer = 0 To sayi
                   
                    ListBox1.Items.Add(OpenFileDialog1.FileNames(i))

                Next
               
            End If

推荐答案





我不认为因此,您可以找到任何能够为您提供高度灵活性的功能,以获取文件和文件夹列表,并将其复制到Windows目录浏览器中的多选复制粘贴。但是,你可以建立一个。请执行以下操作:



1-创建字符串列表

2-将File2和File4的所有路径添加到列表中

3-在目标目的地创建一个具有相同文件夹名称(在本例中为B)的文件夹

4-使用常规IO.File函数将步骤2中列出的文件复制到目的地路径



祝你好运,如果你需要更多帮助,请告诉我。
Hi,

I don`t think so you can find any function that provides you this much high flexibility to get your list of files and folders and copy them somewhere just as multi-selection copy-paste in Windows directory browser. But, you can build one. Do following:

1- Create a list of strings
2- Add all path of File2 and File4 into the list
3- Create a folder with the same folder name (in this case B) at your targeted destination
4- Use general IO.File functions to copy the files listed in step 2 into the destination path

Good luck, let me know if you need more help.


是的,就像你说的我创建了一个解决方案我可以coppy:多次选择文件夹(一个再见)和一次选择文件(多选)。所有文件夹(多于一个以及列表框中列出的多个选定文件都可以一起打印。文件夹文件到文件夹下的文件夹。
Yes as you said I Created a solution and I can coppy : multi Selected Folders (one bye one) and Selected Files (Multilect) at one times. all folders (more then one and also multi Selected Files which listed in listbox can coppy all together. Folders to folder files to under folder.


这篇关于如何一次将所选文件和文件夹复制到另一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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