SSIS 2008: Illegal characters in path when trying to rename a file

491 Views Asked by At

I have a task that should rename a file

I have a variable called RenameFileName

\\servername\csv\BACKUP_" + (DT_WSTR,4)DATEPART("yyyy",GetDate()) + RIGHT("0" + (DT_WSTR,2)DATEPART("mm",GetDate()) ,2) + RIGHT("0" + (DT_WSTR,2)DATEPART("dd",GetDate()),2) + ".csv

When I run the task I get the error

Illegal characters in path

Am I doing anything wrong? I have tried escaping backslashes, and putting it quotes. If I remove the parts with brackets and pluses, it works fine.

Thanks

1

There are 1 best solutions below

0
Thom A On

As I mentioned, you need to escape the backslashes (\ ). Also, you're missing a opening and closing double quote ("):

"\\\\servername\\csv\\BACKUP_" + (DT_WSTR,4)DATEPART("yyyy",GetDate()) + RIGHT("0" + (DT_WSTR,2)DATEPART("mm",GetDate()) ,2) + RIGHT("0" + (DT_WSTR,2)DATEPART("dd",GetDate()),2) + ".csv"