SSIS: Move a Folder from one Drive to Another Drive Using the File System Task
When trying to answer the question in this thread - http://social.msdn.microsoft.com/Forums/sqlserver/en-US/cec6c11f-ec2c-48e2-9c14-199c640ebb05/move-folder-using-file-system-task , the fact that using File system Task by setting the option Operation = Move Directory was discovered. We can move a folder only in the same drive, not across different drives. If we try to move between different drives we will end up with the following error:
***[File System Task] Error: An error occurred with the following error message:
"Source and destination path must have identical roots. Move will not work across volumes."
**
- So the workaround suggested is to move a folder from one drive to another drive using File System Task is as follows:
Drag-drop two File System Tasks on the Control Flow, one for copying the folder from one drive to another drive because using File system Task by setting the option Operation = Copy Directory we can copy a folder across different drives, and the second one for deleting the folder by setting the option Operation = Delete Directory after copying it to destination drive. Hence a folder is moved from one drive to another drive.
Let us consider an example:
A folder named "Anil" in the path C:\Source (source drive) and the destination path is D:\Destination (destination drive)
Copy Directory - File System Task: (To copy the folder "Anil" from C:\Source to** D:\Destination** )
DeleteDirectory - File System Task : (To delete the folder "Anil" from C:\Source )
Connection Managers:
[ Copy Directory (File System Task) - Left top image is Destination Connection Manager, Left bottom image is Source Connection Manager and right side image is Connection manager for DeleteDirectory (File System Task) ]
Using SSIS - Script task with VB / C# code , we can move a folder from one drive to another drive. To move a folder from one drive to another drive using File System Task, the above suggestion is the only work around.