Computing.Net > Forums > Programming > ms dos - delete command

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.

ms dos - delete command

Reply to Message Icon

Name: CBC
Date: January 15, 2009 at 17:32:29 Pacific
OS: Windows XP
CPU/Ram: Intell
Product: Dell / GX520
Subcategory: Batch
Comment:

Hi,

I need to delete all the files more than 90 days old using msdos command script . What parameters do I use with "delete" command?

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: itguru
Date: January 15, 2009 at 23:33:02 Pacific
Reply:

XP has no MS-DOS, therefore you need to use CMD.exe NT COMMAND PROMPT commands:

http://www.ss64.com/nt/
http://www.ss64.com/nt/syntax.html


0

Response Number 2
Name: reno
Date: January 16, 2009 at 06:08:03 Pacific
Reply:

here is solution using vbs/wscript/cscript/wsh/wsf, okay, i am not really sure about what's it called. it looks like vb to me.
this is my first attempt, so i am not responsible for any damage done.

to run, type: cscript datediff.vbs
or just datediff

'datediff.vbs - delete files 90days old (last modified)
Set fs = CreateObject("Scripting.FileSystemObject")
for each f in fs.getfolder(".").Files
	if Datediff("d",date,f.DateLastModified) < -90 then
		wscript.echo f.DateLastModified & "	" & f.name
		'f.delete 
	end if
next

when you are sure it displays the correct file(s), remove the comment on line f.delete

for the cmd.exe script, it involves date math. i think someone will eventually come up with a solution.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: ms dos - delete command

Write the following MS-DOS batch fi www.computing.net/answers/programming/write-the-following-msdos-batch-fi/18277.html

MS Dos batch Script Help www.computing.net/answers/programming/ms-dos-batch-script-help/14592.html

Ms dos www.computing.net/answers/programming/ms-dos/19177.html