Weekly Dynamic: Rename Report Files for Archiving

A question came up in the GP Newsgroup today. MarcB wanted reports printed to a file to be automatically named by GP. This would ease the naming and archiving burden.

Well, there is a way to accomplish the end result, just not with the same method. In Tools->Setup->Posting->Posting you can specify that you want a report to always print to a file and name the file. This will give you a report with the same file name every time. This gets you part of the way there.

Next you’ll need a little VBScript (or something else but for this we’ve got a VBScript app) that will run regularly and rename the file. For this I’ve built a little VBScript app that simply takes the filename and appends the date and time to the end. So TrialBalance.txt becomes TrialBalance-2007-10-02-12-31-01.txt (October 2, 2007, 12:31 and 1 second). The file simply renames the original and puts it in the same location, so a network location is preferred.

Setup the VBScript file to run regularly using Windows Scheduler. This could be every 5 minutes, hourly or once a day. Whatever matches a reasonable frequency for your organization. You can combine multiple files in one VBScript app with just a little copying an pasting.

Basic error handling is included so if there’s no file to rename, you won’t see any error messages. Instructions on where to change the file name and path are included in the file along with notes on how to rename more than one report.

The script file can be found here or in the Download section on the right. It’s free and you’re welcome to make changes for your organizations. Yes, it works in Vista and not it’s not limited to GP related files. You could use it with anything.

Enjoy!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.