Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Deleting files using VBscript
Name: NotForProfit Date: April 27, 2005 at 15:37:39 Pacific OS: Windows 2000 CPU/Ram: unknown
Comment:
I am writing a script to backup files to a USB drive. I would like to delete the old backup folder and all its files then rebuild and populate the folder. Everything works except the delete part. I have tried to use the following code:
Set oShell = CreateObject("WScript.Shell")
oShell.Run "command.com /C rd /s/q e:\backup"
oShell.Run "command.com /C mkdir e:\backup"
the mkdir command works fine but the rd command does not work. Did they disable the abliity to delete files and directories in this way to make VBscript more secure. If so how could I make it work?
Summary: I want to use a vbscript to do daily backups of a log file. I only want to keep 1 month of backups. Does anyone have any suggestions on how I can do this?? -Jackie ...
Summary: I need to delete files from the C:\Company\Temp directory that are older than 120 days. I have to perform this on about 125 PCs. The VBScript keeps bombing on line 27, character 1, where my objFile is...
Summary: Thanks for the information - I am not really familiar with the FOR commands. I have used the "DELETE" command to remove files so many days old, but I also delete the folders with it. ex: "delete /r c:...