Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move all files and Subdirectories from a folder to another Subdirectory of the same folder

I want to move all files and subdirectories including files to another subdirectory of the same folder.

e.g. I have folder named abcd inside I have a file aa and subfolders bb, cc, dd. SO I would like to create another subdirectory inside the same folder as abcd\backup and move aa, bb, cc, dd i.e. all files and folder to backup folder.

like image 348
Indigo Avatar asked Oct 22 '22 06:10

Indigo


1 Answers

This is gonna be very simple.

Directory.Move("SourcePath", "DestinationPath");

Process all directories in the source folder and use the above syntax for each and every folder using forloop or foreach to move to your destination folder.

like image 194
Shafiq Abbas Avatar answered Oct 24 '22 03:10

Shafiq Abbas