Page 1 of 2 12>
Topic Options
#113711 - 2004-02-10 03:24 PM Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
Hello world.

I am trying to delete the temp files from XP/Win2000 network nodes. It is working except for the Subdirectories.

Code:

$tempsht="%temp%"
$tempsht = $tempsht+"\*.* /s"
del $tempsht



Thanks In Advance People!

Top
#113712 - 2004-02-10 03:30 PM Re: Delete the temp files AND subdirectories
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
DEL looks for the two parms to be separate. With your unorthodox concatenation, you are making it into one parm.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#113713 - 2004-02-10 03:37 PM Re: Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
Tried it both ways Les.
No Deal.

del "filename" /s /h

Where filename = "c:\temp\*.*"
also
Where filename = "c:\temp\*.* /s"


Code:
 $tempsht="%temp%"

$tempsht = $tempsht+"\*.*"
del $tempsht /s



No Subs get deleted.
Seems like a pretty simple request, do you delete user temp files at network logon?

If yes, lets see the code. BTW I need to use %temp% I'm not running windows 95 anymore....

Top
#113714 - 2004-02-10 03:45 PM Re: Delete the temp files AND subdirectories
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
What version of KiX. Earlier versions did not support recursion. Try with the latest.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#113715 - 2004-02-10 03:59 PM Re: Delete the temp files AND subdirectories
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no.
I don't delete temp files.
nor do I see any reason for it.
they are local files and I rather let local system get messed up than waste too much time working on it.
_________________________
!

download KiXnet

Top
#113716 - 2004-02-10 04:05 PM Re: Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
KiXtart 2001 4.21 (Copyright Ruud van Velsen 2003)
Top
#113717 - 2004-02-10 04:11 PM Re: Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
(Laughs) Too much time? That is the whole point of Kix is to automate function. Why walk around to 50 machines when you should be able to do it with three lines of code. And you are a Kix moderator????

If you don't care about the local machine you're really not much of a Network administrator are you? (Me thinks you aren't anyway)

That's simply foolish. Try this, click start Run, in the blank type in CMD, then when the dos window appears type in "CD %temp%" (without the quotes) now type "dir /s /p" (without quotes) look at all of the garbage you are keeping on your system... If you get enough files here the computer will not work correctly anymore.

Top
#113718 - 2004-02-10 04:27 PM Re: Delete the temp files AND subdirectories
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See the UDF Forum under CleanDirectory() - Cleans up the temporary directories (or any arbitrary directory)
_________________________
There are two types of vessels, submarines and targets.

Top
#113719 - 2004-02-10 04:27 PM Re: Delete the temp files AND subdirectories
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
ZING!!!
LOL

I don't bother with LUser's temp files either. They get deleted whenever we scrub and re-image thier computers.

There are times when stuff should not be deleted from their %temp% folder because it is there for a reason.

...now if you had some intelligence behind the delete to only get rid of stuff say, a month old. Hmmm... didn't someone write a UDF to do that?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#113720 - 2004-02-10 04:31 PM Re: Delete the temp files AND subdirectories
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Guess what my link is for that I posted the same minute
_________________________
There are two types of vessels, submarines and targets.

Top
#113721 - 2004-02-10 04:36 PM Re: Delete the temp files AND subdirectories
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Les, Lonkero I agree..
When you are a good systems engineer users can't save there data on there local system...Since nowadays HDD's have a very large capacity it isn't neccessary to delete temp files to free up some space. When you can't fix a problem in +/- 15 minutes put a new image on the system and the problem is fixed


Edited by Co (2004-02-10 04:41 PM)
_________________________
Co


Top
#113722 - 2004-02-10 07:22 PM Re: Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
Quote:


I don't bother with LUser's temp files either. They get deleted whenever we scrub and re-image thier computers.





Gee you are right, why fix the door when you can just rebuild the whole house, that's much more efficient.
Bonus: It keeps you from really knowing how to fix anything... (this is starting to show)

Quote:


There are times when stuff should not be deleted from their %temp% folder because it is there for a reason.




Oh Really? And what reason is that? At Startup the Temp is not used. You install something, it gets unpacked in %temp%, gets installed, and you need to reboot. The files are left there, and what a better time to delete them than at Network startup?

Quote:


...now if you had some intelligence behind the delete to only get rid of stuff say, a month old. Hmmm... didn't someone write a UDF to do that?




I found a bug in KIX (DEL does not remove Sub Dirs) and you say there is a UDF for it, then you want a rationale to use a funciton that does not work as expected, as documented, as it should.

Thanks for your OPINIONS, I'm expecting some kind of non-specific reply again based on an incorrect assumption or your opinion containing no evidence.




Top
#113723 - 2004-02-10 07:32 PM Re: Delete the temp files AND subdirectories
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Quote:


I found a bug in KIX (DEL does not remove Sub Dirs)




Why is this supposed to be a bug? The KiXtart Manual clearly states that DEL applies ONLY to files, there's no mention of removing folders, which, BTW, is beign done via RD.
Quote:


Del
Action: Deletes one or more files.

RD
Action: Removes the directory specified.





Quote:


you say there is a UDF for it, then you want a rationale to use a funciton that does not work as expected, as documented, as it should.




And would you please mind explaining what is wrong with the UDF? Why does it not work as expected, or as documented?


Edited by sealeopard (2004-02-10 07:34 PM)
_________________________
There are two types of vessels, submarines and targets.

Top
#113724 - 2004-02-10 07:50 PM Re: Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
The UDF works ok.

I am mistaken on DEL. The "/s" includes files in Sub dirs not the Subdirs themselves.

If would be nice if RD has the /s option, I guess I'll use the UDF then...

Sorry about that, my Subject line was worded as unambiguous as possible... (Note the capitalization of the word AND)

Top
#113725 - 2004-02-10 08:06 PM Re: Delete the temp files AND subdirectories
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I don't understand what were wrong in our answers.
you asked do we do trash the temp.
we said no.

what is wrong in answering your question?
_________________________
!

download KiXnet

Top
#113726 - 2004-02-10 08:06 PM Re: Delete the temp files AND subdirectories
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
First off, I don't care for your tone! You are here asking for help! I don't owe you anyting!

Quote:

You install something, it gets unpacked in %temp%, gets installed, and you need to reboot. The files are left there, and what a better time to delete them than at Network startup?




How about when the install needs to complete after rebooting and you yank the files before it finishes! Also, you must be running some very simple systems if there is nothing running at logon time. Most of my systems have some temp files in flux at that time.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#113727 - 2004-02-10 08:13 PM Re: Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
Gee Les, you seem to have complete knowledge so I won't waste your time.

Have a nice day.

Top
#113728 - 2004-02-10 08:19 PM Re: Delete the temp files AND subdirectories
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jens is far smarter than me. After all, he knew enough to write the UDF and to provide for the "older than" parm.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#113729 - 2004-02-10 08:25 PM Re: Delete the temp files AND subdirectories
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, you say you don't posses the ultima-knowledge afterall?
_________________________
!

download KiXnet

Top
#113730 - 2004-02-10 08:41 PM Re: Delete the temp files AND subdirectories
Babbage Offline
Fresh Scripter
*

Registered: 2004-02-10
Posts: 8
The more one knows the more one realizes one does not know.

This is what I said:
Quote:


Gee Les, you seem to have complete knowledge so I won't waste your time.







lol


Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 400 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.072 seconds in which 0.023 seconds were spent on a total of 11 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org