S samperizal Active Member Licensed User Longtime User Nov 30, 2019 #1 Regards. How to select a directory. Thank you
Daestrum Expert Licensed User Longtime User Nov 30, 2019 #2 It's a bit of an ambiguous question, can you give an example of where you want to select a directory? Upvote 0
It's a bit of an ambiguous question, can you give an example of where you want to select a directory?
S samperizal Active Member Licensed User Longtime User Nov 30, 2019 #3 What you want is to select a source directory and a destination directory and move all files from the source to the destination. Upvote 0
What you want is to select a source directory and a destination directory and move all files from the source to the destination.
Daestrum Expert Licensed User Longtime User Nov 30, 2019 #4 If it just one level of directory then you can use something like Code: Copy Dim srcDir as String = "C:/temp/someFolder" Dim destDir as String = "C:/temp/someOtherFolder" ' this must exist for the copy to work Dim srcFiles as List = File.ListFiles(srcDir) For Each f As String In srcFiles File.Copy(srcDir, f, destDir, f) Next If there are directories within the srcDir you want to copy, then you need to detect if f is a directory (File.IsDirectory(srcDir,f) and code accordingly (eg recursively read the sub directories) Upvote 0
If it just one level of directory then you can use something like Code: Copy Dim srcDir as String = "C:/temp/someFolder" Dim destDir as String = "C:/temp/someOtherFolder" ' this must exist for the copy to work Dim srcFiles as List = File.ListFiles(srcDir) For Each f As String In srcFiles File.Copy(srcDir, f, destDir, f) Next If there are directories within the srcDir you want to copy, then you need to detect if f is a directory (File.IsDirectory(srcDir,f) and code accordingly (eg recursively read the sub directories)
S samperizal Active Member Licensed User Longtime User Nov 30, 2019 #5 Thank you. What I want is to be able to select the dirrerorios not to leave them fixed. Thank you Upvote 0
stevel05 Expert Licensed User Longtime User Nov 30, 2019 #6 Use DirectoryChooser Code: Copy Dim DC As DirectoryChooser DC.Initialize DC.InitialDirectory = 'Directory you want to start the chooser (Optional) Dim Folder As String = DC.Show(MainForm) Upvote 0
Use DirectoryChooser Code: Copy Dim DC As DirectoryChooser DC.Initialize DC.InitialDirectory = 'Directory you want to start the chooser (Optional) Dim Folder As String = DC.Show(MainForm)