Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Cleanup txt files from Z:\drive issue? Expand / Collapse
Author
Message
Posted Tuesday, October 9, 2012 1:16 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
I have job setup on all the PROD servers(2005, 2008r2, 2012).

The Job will generate a .txt file every day for each database to scripts out permission.
And saving a permission scripts for 5day and do clean up.

Here is the issue,
I am doing maintenance cleanup task(maintenance plan) to do a cleanup,
But it is not working, It does not clean up the .txt file on any of the servers (2005, 2008r2, 2012).

what was the issue? Do I am doing wrong way to do cleanup?
any alternate solution do do clean up?
example my file name conversation are: DBname_DBuserlist_20121009

Post #1370550
Posted Tuesday, October 9, 2012 1:46 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, June 25, 2014 6:37 PM
Points: 351, Visits: 899
Does your Maintenance Plan Cleanup task look like this? Note the lack of a dot (.) in the File extension box. Also, if you're creating directories for each DB, you'll need to check the box next to "Include first-level subfolders". Also make sure the folder path is correct if you're not placing the files on the root of Z:\

Post #1370564
Posted Tuesday, October 9, 2012 2:44 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
Yes looks the same


Post #1370586
Posted Wednesday, October 10, 2012 6:55 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, June 25, 2014 6:37 PM
Points: 351, Visits: 899
Do the accounts for SQL Server and SQL Server Agent have permissions to the path you're attempting to delete files in? How are you executing the Maintenance Plan, through a SQL Server Agent job?
Post #1370897
Posted Wednesday, October 10, 2012 8:13 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
Using SA account.

All my .bak backup cleanup history works fine, cleanups after 48Hrs.

I doesn't work for my txt file to cleanup. These txt file are created by job in process, these are not report txt files.

Is there is way, I can create a job step to clean up txt files

any help please!
Post #1370945
Posted Wednesday, October 10, 2012 8:39 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 5:29 PM
Points: 3,112, Visits: 11,366
Danzz (10/10/2012)
Using SA account.

All my .bak backup cleanup history works fine, cleanups after 48Hrs.

I doesn't work for my txt file to cleanup. These txt file are created by job in process, these are not report txt files.

Is there is way, I can create a job step to clean up txt files

any help please!


The maintenance plan file cleanup tasks only cleanup backup files created by maintenance plans or report text files created by maintenance plans.

You could use ActiveX , Command shell, or Powershell to cleanup the txt files.



Post #1370973
Posted Wednesday, October 10, 2012 12:34 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
Thanks Michael!

Can I get a command of (ActiveX , Command shell, or Powershell)
example my file name are: DBname_DBuserlist_20121009.txt
Location Z:\Permissions\
Post #1371079
Posted Wednesday, October 10, 2012 2:30 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, June 25, 2014 6:37 PM
Points: 351, Visits: 899
The TechNet site is a good place to start. I believe there are several "delete files older than X" type scripts there:

http://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=ProgrammingLanguage&f%5B0%5D.Value=PowerShell&f%5B0%5D.Text=PowerShell
Post #1371118
Posted Wednesday, October 10, 2012 3:34 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
Thanks !
Post #1371144
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse