homepage Welcome to WebmasterWorld Guest from 54.204.59.230
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Deprecated - Microsoft Windows OS (XP/NT/Vista)
Forum Library, Charter, Moderators: bill

Deprecated - Microsoft Windows OS (XP/NT/Vista) Forum

    
automatically and recursively delete all html files in a folder
jamie




msg:1569155
 9:21 am on Feb 28, 2006 (gmt 0)

hi,

i'd like to recursively search through a folder and subfolders and delete all html files.

this should run on scheduler every morning for instance.

i am used to *nix (using cron and find) - is there a windows equivalent? (i run winxp pro)

many thanks

 

coopster




msg:1569156
 3:05 pm on Feb 28, 2006 (gmt 0)

Windows has a job scheduler --
Start > Control Panel > Scheduled Tasks > Add Scheduled Task
where you could setup your own DEL (ERASE) command. I believe the syntax might be
DEL /S C:/PATH/TO/BASEDIR/*.html
Since a directory is specified, all files matching the wildcard in the directory should be deleted and the /S switch says to delete specified files from all subdirectories. You'll have to test this as my DOS programming is getting weak ;-)
bill




msg:1569157
 1:41 am on Mar 1, 2006 (gmt 0)

Good suggestion coopster. You can use the scheduler to run DOS batch files at scheduled times to the same effect. My machines run through several self-cleaning batch files every night using Scheduled Tasks.

Here's some info on how to use batch files on XP from Microsoft: Using batch files [microsoft.com].

Robert Charlton




msg:1569158
 9:19 am on Mar 1, 2006 (gmt 0)

This thread reminds me that when there was a full DOS window, as in Windows 9x, I used to use batch files a lot. Some of the old DOS shareware utilities like pcopy (anyone remember pcopy?) and pdel were extremely versatile.

Now, I'm not using batch files at all. It helps to be reminded that they're still viable, but that basic disk level is so well hidden that it's almost a stretch for me. Any other references besides that Microsoft page to get the juices flowing?

bill




msg:1569159
 2:06 am on Mar 2, 2006 (gmt 0)

Any other references besides that Microsoft page to get the juices flowing?

Actually one page up from that link I provided is the complete Command-line reference A-Z [microsoft.com] that you can use to make Windows do all the fun stuff. ;)

coopster




msg:1569160
 2:13 am on Mar 2, 2006 (gmt 0)

I always figured MS was going to try and push folks away from the old commands once they had their own scripting engine in place. Nice to see some diehards still pushing the envelope ;)

bill




msg:1569161
 2:44 am on Mar 2, 2006 (gmt 0)

My beta copy of Longhorn/Vista still has this function available, so it's a good trick to have in your bag.

coopster




msg:1569162
 4:18 am on Mar 2, 2006 (gmt 0)

Oh, I'm sure it will remain for some time. What I meant was the scripting engine that came out so many years ago seemed like it was poised to replace the old DOS command line interface tools. I am with you though bill, I think we shall see the MS command line interface remain. Don't know how much they will build upon it, but I do think it is here to stay for awhile. You seeing anything new in the beta?

bill




msg:1569163
 4:25 am on Mar 2, 2006 (gmt 0)

The beta I have installed is a bit old so I'm not seeing much yet. I need to find some time to install the recent CTP build [webmasterworld.com]. That's supposedly closer to being feature complete.

The real theme for Vista is security. It's safer out of the box. The good thing is that I'm not seeing them take away the configurable parts like our pal the Command Line. As long as my batch files will still work I'm happy. ;)

jamie




msg:1569164
 3:50 pm on Mar 2, 2006 (gmt 0)

coopster and bill,

thank you very much!

i'll play around with this and get back if i have problems,

cheers

jamie




msg:1569165
 2:19 pm on Mar 15, 2006 (gmt 0)

so....

i have used cooper's suggestion which works perfectly.

i have saved that line in a .bat file, but it won't run automatically via windows scheduler - is there any trick to that?

thanks

coopster




msg:1569166
 3:03 pm on Mar 15, 2006 (gmt 0)

No, not really. Just make sure you have the correct permissions of course. Open up the Scheduled Task and look at it's properties. Go through each of them to make sure you have it set to run.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Deprecated - Microsoft Windows OS (XP/NT/Vista)
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved