user1254579
user1254579

Reputation: 4009

how to rename folder and its all sub folder using ssis

In file System task there is no option to rename a folder.The option is to rename file. I do understand we can achieve renaming of multiple fils using a for each loop and file system task. Is there any wayto rename a folder and all it's sub folder using any of the tasks in ssis

Upvotes: 0

Views: 1810

Answers (1)

billinkc
billinkc

Reputation: 61269

File System Task is the tool you want. A Move Directory is the same as a Rename.

Example

Configure it as such. I prefer variables as it makes my packages cleaner

enter image description here

You could of course get the same results by running an Execute Task command and using the rename command

Renames a file or files.

RENAME [drive:][path]filename1 filename2. REN [drive:][path]filename1 filename2.

Note that you cannot specify a new drive or path for your destination file.

Finally, if you just like making things hard, you could use a Script Task and leverage the System.IO.Directory's Move method but on behalf of everyone who has to maintain novel approaches to solving problems, just use the File System Task

Upvotes: 4

Related Questions