Eamon
asked on
Delete folders based on values from recordset using File System Task
Hi,
I'm relatively new to SSISs.
What I currently have is a dataflow task which loads up my folder names into an ADO variable using an OLE DB Source to a record set.
I have a predefined path of where these folder names sit. e.g - "\\myServer\store\"
What I need to do is loop through my recordset and append each folder name to my path and delete that folder using File System Task? e.g. delete "\\myServer\store\Folder1F romAdoVari able", "\\myServer\store\Folder2F romAdoVari able" etc
I have had a look at a ForEach loop container but no success.
I'm relatively new to SSISs.
What I currently have is a dataflow task which loads up my folder names into an ADO variable using an OLE DB Source to a record set.
I have a predefined path of where these folder names sit. e.g - "\\myServer\store\"
What I need to do is loop through my recordset and append each folder name to my path and delete that folder using File System Task? e.g. delete "\\myServer\store\Folder1F
I have had a look at a ForEach loop container but no success.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Could be a scope issue on the variable.
See image (left side). There's a "scope" section under variables. Try setting to "Package" if it's not already.
ssis-script-01.jpg
See image (left side). There's a "scope" section under variables. Try setting to "Package" if it's not already.
ssis-script-01.jpg
Please make sure the scope of variable at PAckage level not to be at specific task level otherwise you will not get access of those variables define at task level and want to use at other task.
ASKER
I was putting the file path into the variable name rather than the variable value for my source connection.
All appears to be working okay now.
All appears to be working okay now.
ASKER
I now get an error:
Error: Failed to lock variable "\\myServer\store\1471470"
Folder "1471470" is coming from my recordset which is good.