I have a folder which is having another sub folder? How to move/copy all the files available in subfolders?
Use this code snippet to get all the files including sub folders.
Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories)
If you are looking to move only files from sub folders alone, then you need to get the sub folder name then use it as the source folder + file name in the move file activity.
No there are lot of files, how to add file name everytime?
You can change the GetFiles() arguments to read the files from the subfolders as well.
For the first run you will get the files there inside all the folders, for the next run you will get rest (Latest files). if you are looking for some kind of File watchedr then check this link.
Get Files from sub Directories as well
Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories)
File Name with extension into a List of string
New System.IO.DirectoryInfo(strDesktop).GetFiles().Select(Function(file) file.Name).ToList()
File Name with extension into a String Array
New System.IO.DirectoryInfo(strDesktop).GetFiles().Select(Function(file) file.Name).ToArray()
File Name alone into a List of string
New System.IO.DirectoryInfo(strDesktop).GetFiles().Select(Function(file) Path.GetFileNameWithoutExtension(file.Name)).ToList()
File Name alone into a String Array
New System.IO.DirectoryInfo(strDesktop).GetFiles().Select(Function(file) Path.GetFileNameWithoutExtension(file.Name)).ToArray()
Full path into a List of string
new System.IO.DirectoryInfo(strDesktop).GetFiles().Select(Function(file) file.FullName).ToList()
Full path into a String Array
new System.IO.DirectoryInfo(strDesktop).GetFiles().Select(Function(file) file.FullName).ToArray()
Yes your’e correct
f1=Directory.GetFiles(dirPath, “*”, SearchOption.AllDirectories)
while using the variable f1 into the move file activity
it is throwing error"1-dim to String"
@rsr.chandu …F1 should be stringArray. Not string.