|
Answer» Hi all,
Can this be done with a batch file :-
I have mulitple handheld units running under dos requiring backup folders to be deleted at a regular basis to free up space. These backup folders are stored in the G: along with other files and folders. All backup folders are named as follows :- UP_mmdd1 and as an example the following may be found on G: drive :-
UP_04281 UP_04291 UP_04301 UP_05011 UP_05021
Each unit may have a multiple number of backup folders and they may be dated differently (but in the same format as above) depending on use of the individual unit.
Currently to free up space I need to reformat each unit and reinstall all software. I was hoping to use a batch file to delete all the backup folders on each unit would this be possible ?
Thanks in advance for any asistance. Cheers Gonzo
For use in a batch file:
Code: [Select]@echo off for /f "delims=" %%i in ('dir g:\up_* /b /a:d') do rd %%i /s /q
Notes: Assumes directories are in root directory of g: drive. Assumes all directories you want deleted are masked as up_
The /s switch for RD will delete any sub-directories. The /q switch will suppress the OK? message for each directory.
Suggest running first with ECHO instead of RD to make sure you will process what you intended.
Good luck. 8-)Many thanks Sidewinder it worked LIKE a 'charm' GREATLY appreciate your assistance.
Just one more request for help.....hopefully!!!
Some of the older units are using dr dos 7.02 (newer units are using the lastest ms dos) and the batch file doesn't work on these units, message appears saying 'syntax error'.
Any hints on how I could tweak the batch to work on these units. Apparently ver 7.03 of dr dos does not support "FOR /F[option] %" syntax and also all files must be deleted first from a dir before the dir can be deleted. I believe ver 7.03 is most compatible with the ms dos ver that shipped with win 95.
Again many thanks for your help.
Cheers GonzoI checked out the DR-DOS user manual and couldn't find anything that would be useful for your purposes. Basically you need a method to do SOMETHING over a collection of directories.
There are a few scripting languages for DOS that can easily do this. REXX is probably the easiest to learn and you are only limited by your imagination.
You can get Rexx as a download.
Even Win95C is able to run VBScript.
This may be possible with the batch VERSION you have but I have no snippets in my closet that come close to doing this. This post will bump your post to the top where someone may find it and have a solution.
Good luck. 8-)Thanks for the info. I will have a go at Rexx and see how I go.
Thanks for your help, it is greatly appreaciated.
Cheers gonZoThis may be a bit simplistic, but I was just creating a batch file to do a similar task. The approach that worked was to use the following line in a batch file:
cmd /c rd "G:\<backup foldername>" /S /Q
where backup foldername is the folder where all of the backup files are located on your g drive. This does assume that there is one central folder that all of these are being stored, even if there are subfolders for each handheld device under this one central one. Seems as though you should be able to set the location where you want the backups to go, in your handheld config.
hope this helps.
|