Forum Discussion

tuanvinh1008's avatar
tuanvinh1008
Contributor
3 years ago
Solved

Ony copy files and sub-folder in a folder to another

Hi all,

I have the folders and files as structure

|Folder A

|   | Folder A1

|   |    | FileA1A.txt

|   |    | FileA1B.txt

|   | FileA.txt

|   | FileB.pdf

 

and I only want to copy all files and folders under the folderA to Folder B as structure below

 

|Folder B

|   | Folder A1

|   |    | FileA1A.txt

|   |    | FileA1B.txt

|   | FileA.txt

|   | FileB.pdf

 

If I use these code

var FolInfo = aqFileSystem.GetFolderInfo(FolderAPath);
// Copies the folder to another location
FolInfo.Copy(FolderB, false);

 

It will copy all files and folders include FolderA into FolderB as below. But I don't the copy the root folder name (Folder A)

FolderB

 |Folder A

 |   | Folder A1

 |    |    | FileA1A.txt

 |    |    | FileA1B.txt

 |    | FileA.txt

 |    | FileB.pdf

 

Thanks,

Vinh

3 Replies