Showing posts with label content. Show all posts
Showing posts with label content. Show all posts

Wednesday, March 7, 2012

File system Task -Delete Directory Content

This delete's the directory content as well as sub directory content! Is their a way i can just set it to delete the files in the said directory and not sub directories?Do you mean the FIle System Task? File System Object was a feature of WSH and used a lot in DTS, not SSIS.|||Yes i do mean the file system task in ssis. It has an option to delete directory content that deletes subdirevtory content as well. I just want to delete the files in the directory and not the sub directory. Can this task do this or do i have to revert to writing script using the File System Object to do this?|||You could use a For Each Loop to iterate the files in the directory and then the File System Task to delete them individually.
|||

Mike Tomkies wrote:

Yes i do mean the file system task in ssis. It has an option to delete directory content that deletes subdirevtory content as well. I just want to delete the files in the directory and not the sub directory. Can this task do this or do i have to revert to writing script using the File System Object to do this?

Use a foreach loop to spin through the directory of your choosing. This will allow you to use a wildcard to get at the files you are specifically interested in deleting (even if it's *.*). Then inside the foreach loop, use a File System Task set to "Delete File". Pass in the file name from the foreach loop and you should be set.|||This for each loo how will it read the file names to pass to the task to delete?|||

Mike Tomkies wrote:

This for each loo how will it read the file names to pass to the task to delete?

It's built to do that. Click on the Collection tab and the enumerator should be set to "Foreach File Enumerator". From here, just give it a base directory and let it go to work.|||Thanks that is what i need.|||Think it would of been easy if The File system Task had the Traverse SubFolders option as in the ForEachLoop Container.

File system Object -Delete Directory Content

This delete's the directory content as well as sub directory content! Is their a way i can just set it to delete the files in the said directory and not sub directories?Do you mean the FIle System Task? File System Object was a feature of WSH and used a lot in DTS, not SSIS.|||Yes i do mean the file system task in ssis. It has an option to delete directory content that deletes subdirevtory content as well. I just want to delete the files in the directory and not the sub directory. Can this task do this or do i have to revert to writing script using the File System Object to do this?|||You could use a For Each Loop to iterate the files in the directory and then the File System Task to delete them individually.
|||

Mike Tomkies wrote:

Yes i do mean the file system task in ssis. It has an option to delete directory content that deletes subdirevtory content as well. I just want to delete the files in the directory and not the sub directory. Can this task do this or do i have to revert to writing script using the File System Object to do this?

Use a foreach loop to spin through the directory of your choosing. This will allow you to use a wildcard to get at the files you are specifically interested in deleting (even if it's *.*). Then inside the foreach loop, use a File System Task set to "Delete File". Pass in the file name from the foreach loop and you should be set.|||This for each loo how will it read the file names to pass to the task to delete?|||

Mike Tomkies wrote:

This for each loo how will it read the file names to pass to the task to delete?

It's built to do that. Click on the Collection tab and the enumerator should be set to "Foreach File Enumerator". From here, just give it a base directory and let it go to work.|||Thanks that is what i need.|||Think it would of been easy if The File system Task had the Traverse SubFolders option as in the ForEachLoop Container.

Friday, February 24, 2012

File output

I have read an Oracle article about the content management system they implemented, and was wondering whether a similar thing was possible with SQL Server.

The system basically stored the content of articles etc. in the database, as well as revisions etc., a stored procedure then generated an html page from the database content, my guess is that this then updated any necessary pages containing links etc.

My question is basically whether SQL Server (or T-SQL to be more precise) includes the ability to output the contents of fields into a file, so that when an SP was called it would generate the HTML for a page and output it to a file on the server. Thus avoiding the need to generate a page every time a request is received.

Thanks,
PaulI can think of a few ways to do this. I don't know of anything built in to SQL Server to handle this.

Do you want to call the sp from within the SQL server or from the command line?

Do you want the ability to (re)build only one file at a time or rebuild all files?

Do you have any metadata on the file names and locations?

Post back or "E" me directly.|||The idea would be that the stored procedure could be called when a record is inserted, thus when someone writes content it then creates the HTML page.

My guess is that there would also be the need to then update any linked pages, so if you wanted a link on the home page, the home page would also be re-written.

Anyway, it was nothing more than a thought, and was curious as to how SQL Server might support this kind of functionality.

Paul