+WascoZooKeeper Posted April 29, 2005 Posted April 29, 2005 I have a macro to create MS S&T files by cache type. At the beginning of it, I want to delete all of the existing files in the given directory, so that if on a given occasion there are no new files created for a given type, I won't pick up an old one. I assume I have to use a RUNPGM command, but I haven't figured out just how to get it to do what I want. From a DOS prompt, I would enter: DEL C:\Data\GSAK\Home\SNT\*.csv The GSAK macro equivalent would be . . . . ??? Quote
+Hi-Tek Posted April 29, 2005 Posted April 29, 2005 (edited) I have a macro to create MS S&T files by cache type. At the beginning of it, I want to delete all of the existing files in the given directory, so that if on a given occasion there are no new files created for a given type, I won't pick up an old one. I assume I have to use a RUNPGM command, but I haven't figured out just how to get it to do what I want. From a DOS prompt, I would enter: DEL C:\Data\GSAK\Home\SNT\*.csv The GSAK macro equivalent would be . . . . ??? You could create a Batch file in your GSAK\Macros\ folder (use a plain text editor, the same one you use to create GSAK macros will do fine) with this command DEL C:\Data\GSAK\Home\SNT\*.csv and call it something like DeleteCSV.bat. Then create a GSAK Macro that includes this line RUNPGM pgm="C:\Program Files\GSAK\Macros\DeleteCSV.bat" wait=YES Edited to correct typo! Edited April 29, 2005 by Motley Crew Quote
+WascoZooKeeper Posted April 29, 2005 Author Posted April 29, 2005 I have a macro to create MS S&T files by cache type. At the beginning of it, I want to delete all of the existing files in the given directory, so that if on a given occasion there are no new files created for a given type, I won't pick up an old one. I assume I have to use a RUNPGM command, but I haven't figured out just how to get it to do what I want. From a DOS prompt, I would enter: DEL C:\Data\GSAK\Home\SNT\*.csv The GSAK macro equivalent would be . . . . ??? You could create a Batch file in your GSAK\Macros\ folder (use a plain text editor, the same one you use to create GSAK macros will do fine) with this command DEL C:\Data\GSAK\Home\SNT\*.csv and call it something like DeleteCSV.bat. Then create a GSAK Macro that includes this line RUNPGM pgm="C:\Program Files\GSAK\Macros\DeleteCSV.bat" wait=YES Edited to correct typo! Whoa. Too simple. Thanks for the suggestion! Quote
+Pasha Posted April 29, 2005 Posted April 29, 2005 It's actually easier than that. Assuming you're using anything Windows 2000 or newer: RUNPGM Pgm="C:\Windows\System32\cmd.exe" Parms="/C del /Q C:\Data\GSAK\Home\SNT\*.csv" Wait=Yes You run the windows command interpreter with the del command as an argument. The \Q argument to del is so that it won't ask you for confirmation when deleting multiple files. Quote
+Hi-Tek Posted April 29, 2005 Posted April 29, 2005 It's actually easier than that. Assuming you're using anything Windows 2000 or newer: RUNPGM Pgm="C:\Windows\System32\cmd.exe" Parms="/C del /Q C:\Data\GSAK\Home\SNT\*.csv" Wait=Yes You run the windows command interpreter with the del command as an argument. The \Q argument to del is so that it won't ask you for confirmation when deleting multiple files. For windows 2000 you'll need to use WINNT in place of Windows RUNPGM Pgm="C:\WINNT\System32\cmd.exe" Parms="/C del /Q C:\Data\GSAK\Home\SNT\*.csv" Wait=Yes Quote
+mrking Posted April 30, 2005 Posted April 30, 2005 Holy Crap I thought I was a computer geek, but this stuff just flew over my head. Something tells me I am getting too old... This does sound very usefull though. Just to confirm, this code would export a .csv file of all the chosen caches and save it to the directory of choice, in this case SNT, but first it will delete any and all files within that directory? Could this be done to creat a regular old .GPX file as well? Given the fact that the .csv could be replaced with .gpx? Quote
+ClydeE Posted April 30, 2005 Posted April 30, 2005 Holy Crap I thought I was a computer geek, but this stuff just flew over my head. Something tells me I am getting too old... This does sound very usefull though. Just to confirm, this code would export a .csv file of all the chosen caches and save it to the directory of choice, in this case SNT, but first it will delete any and all files within that directory? Could this be done to creat a regular old .GPX file as well? Given the fact that the .csv could be replaced with .gpx? Yep, you can do this and a whole lot more with the macro language. Please see the "Automating GSAK" topic in the help file or online here http://gsak.net/help/hs21000.htm Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.