Skip to content

A windows command line tool to delete older exports from OSQL.exe

Notifications You must be signed in to change notification settings

riffzone/osql-cleanup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

osql-cleanup

OSQL.exe is a Microsoft SQL Server utility to export the content of a database in .BAK files.
osql-cleanup.exe is designed to be automatically launched in a daily basis, and deletes all the OSQL .BAK files from an export folder that are older than a specified number of days.

Usage : osql-cleanup.exe --dir=<folder> [--days=<days>]
<folder> is the path of the folder to scan, sub-folders are ignored
The .BAK files older than <days> days are deleted, default value is 7 days

The .BAK files can be created by the following command :

"[PATH_TO]OSQL.exe" -S <SQL_SERVER> -U <USER> -P <PASS> -Q "BACKUP DATABASE <BASE_NAME> TO DISK='[EXPORT_PATH]%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%-<BASE_NAME>.BAK'"

About

A windows command line tool to delete older exports from OSQL.exe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published