This stored procedure was written to get around the lack of support for maintenance plans in MSDE. The user specifies the type of backup (FULL, LOG or DIFFERENTIAL), the db name, the folder to hold the backup file and the retention period in days (anything older in the backup folder for the specified backup type is deleted). See usage instructions in the code or run the procedure with no parameters.
It doesn't handle long filenames for some reason, so use 8.3 names for folders.
The stored procedure also has a parameter for debugging. Set to 1 to have commands printed out during the execution of the procedure.