1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Another Temp Folder

Discussion in 'Windows XP' started by jslow, 2003/02/11.

Thread Status:
Not open for further replies.
  1. 2003/02/11
    jslow

    jslow Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    377
    Likes Received:
    0
    Hi,
    Does anyone know what the
    C:\Documents & Settings\your name\Local Settings\Temp
    folder is for? Are the files in this folder important?
    We have files like the following in it:
    *Folders ending in .dir and .diroo
    *Files ending in .doc
    *Som fci24, ect with no extensions
    *A lot of hph followed by a number but with no extension
    *hpzcoioo.log files
    *MSI1c602.Log files
    *OCR0001.rtf files
    *pihp(0002).txt and pihp(0004)_MsiExe.txt files

    It looks like this folder may be a catch all for temp files.

    Any suggestions?
    Thanks
     
  2. 2003/02/11
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    Dump them all, you'll never miss them.

    I use a batch file that dumps mine prior to running an incremental backup which I do several times daily. That's why I can say without a doubt, you'll never miss those files. They are like your own personalized Temp files and each user will have such. These are in addition to the normal Temp folder in Windows and often another on the root of the drive.

    I just ran a test and it seems that the Disk Cleanup done by XP doesn't touch these files so you'll be stuck with the job manually.

    Cheers. :)
     
    Last edited: 2003/02/11

  3. to hide this advert.

  4. 2003/02/11
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    This is the batch file I use to unclutter the drive somewhat prior to doing a backup.

    ++++++++++++++++=Tempzap.bat script follows+++++++++

    ECHO OFF
    echo y | del c:\windows\prefetch\*.*
    echo y | rd/s "C:\Documents and Settings\Owner\Local Settings\Temp\ "
    echo y | rd/s "G:\Temporary Internet Files "
    echo y | rd/s c:\temp\
    echo y | rd/s c:\windows\temp\
    md "C:\Documents and Settings\Owner\Local Settings\Temp\ "
    md c:\temp
    md c:\windows\temp

    ++++++++++++++++++End of script+++++++++++++++

    As you may notice, I keep the TIF's on my G: drive but so since I'm backing up the C: drive, I just delete them for spite. :)
     
  5. 2003/02/11
    Christer

    Christer Geek Member Staff

    Joined:
    2002/12/17
    Messages:
    6,585
    Likes Received:
    74
    Zephyr,
    does this batchfile clear all user temp folders or only those for the current user?
    Do you have to do this logged in as administrator?

    Thanks,
    Christer
     
  6. 2003/02/11
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    It's tailored to my system since my log on id is Owner. You would need to edit it according to your id and add similarly scripted lines to be able to delete other id's temps. Then also add a line to recreate the folder it deleted.

    The RD/S command removes the directory and all sub-directories while the MD makes the replacement directory. This is necessary because the Deltree command is not available in XP.

    It should work regardless of who runs it and should not need administrative priveledges under an ordinary system configuration. I don't think the temp files are restricted to anyone ever.

    Holler if you need help molding it for your purposes.

    :)
     
  7. 2003/02/11
    jslow

    jslow Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    377
    Likes Received:
    0
    Hi Zephyr,
    Thanks for the reply.
    Now I'll have to learn how to create a batch file to get rid of these files.
     
  8. 2003/02/11
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    jslow, You can just use the script I posted and save it under any name you like so long as you keep the .bat extention. Change the two occurences of Owner to suit your own particular identity tag and change the G: to C: you'll be all set.

    Good luck. Post back if you need help.
     
    Last edited: 2003/02/11
  9. 2003/02/11
    jslow

    jslow Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    377
    Likes Received:
    0
    Hi Zephyr,
    Thanks again forthe reply.
    Just to refresh my memory, you just type the script in Notepad and then save it as "Tempzap.bat" or something similar, is tha right?
     
  10. 2003/02/11
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    Well, actually you could make it easier than that by using the copy/paste method. But yes, you can type it all in Notepad and save it as whatever you like with a bat extension. Just make the minor changes I mentioned earlier to suit it to your drive.

    Don't be afraid of it, it won't bite nor do any harm so you have nothing to lose and much to gain from batch files. If you fail, post back and we'll give you a hand.

    :)
     
  11. 2003/02/11
    jslow

    jslow Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    377
    Likes Received:
    0
    Thanks Zephyr,
    We'll give it atry.
     
  12. 2003/02/12
    jslow

    jslow Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    377
    Likes Received:
    0
    Hi Zephyr,
    I have a couple more questions.
    My C:\Windows\temp folder has a lot of files such as "MSI1ac2a.log "
    (probably well over a hundred of them). Can these be deleted?

    But there are also some files that appear to be active files such as:
    "CONEXANT_INSTALL.LOG" and "ERTS0375.xe" so I'm leery about deleting all files in this folder.

    In addition my C:\temp file very seldom has anything in it. I sometimes put files in here before sending them to the recycle bin.

    Thanks
     
  13. 2003/02/12
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    You must know what my answer will be by looking at the batch file I use. Delete them all manually or run the batch file I posted.

    The only time I can think of that deleting any Temp folder could cause a problem would be in the middle of an install. You wouldn't likely do that, now would you?

    The trash you see there now is due to several installs that you have made and they failed to clean up after themselves. It happens often when the system crashes before completing an install, and other times just because the software had poorly written code.

    Delete them!!!
     
    Last edited: 2003/02/12
  14. 2003/02/12
    jslow

    jslow Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    377
    Likes Received:
    0
    Thanks Zephyr for the quick reply.
    I'll try your suggestion
    Thanks
     
  15. 2003/02/13
    Dennis L Lifetime Subscription

    Dennis L Inactive Alumni

    Joined:
    2002/06/07
    Messages:
    2,557
    Likes Received:
    2
    Hi Zephyr

    Have tried your .bat routine (making path adjustments) and it works fine. Would like to add other files into the routine. My questions are the commands. Using your flow structure do I prefex the file path with....
    echo y | rd/s
    THEN.....
    md
    ALSO
    When / Why do you use " " around some of the file paths.
    Thanks
     
  16. 2003/02/13
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    Hi Dennis L,

    Thanks for the affirmation but I'm not surprised that it works fine. :D I have used this script and other earlier versions of it for over 8 years. I run it on average of 3 to 5 times daily. That would give me well in excess of 10,000 executions without a hitch. Yes, it works fine. ;)

    Here's the deal:

    The script echo y | rd/s is equivalent to Deltree /y.

    XP doesn't have the Deltree command so it's necessary to get creative. The echo places the following letter (Y, meaning yes) into the command and the pipe redirects the Y to the subsequent command (rd/s, which is asking to Remove Directory and all Subdirectories.) as a response to the inevitable "Are you sure you want to delete the directory and all subdirectories?" That gets you out of stalling the batch progress while it waits for your approval.

    Then of course you normally want to recreate an empty Directory to replace the one you just Removed. That's where the mdcomes into play.

    The only path commands that need " " around them are ones that have embedded spaces in them. The command line interface will not accept spaces otherwise and will issue an error.

    While you are experimenting, you may wish to place a pause command as the last line in the batch so you can review what actions took place.

    btw, pay no mind to some of the inevitable error messages you may get from this batch, such as, "Cannot delete index.dat" or "Cannot create directory, it already exists." Those are normal and not to be worried about. This occurs when some file is active and can't be deleted so the Directory must remain also.

    Cheers. :)
     
    Last edited: 2003/02/13
  17. 2003/02/13
    terrafutan

    terrafutan Inactive

    Joined:
    2002/12/30
    Messages:
    28
    Likes Received:
    0
    Well I can help translate the commands for you.

    >> echo y | del c:\windows\prefetch\*.*

    allows you to delete the contents of the folder and automatically responds to the y/n question. hence the echo y

    >>echo y | rd/s c:\temp\
    >>md c:\temp

    same thing except this time you are removing the complete directory with the RD command, and then once deleted the MD commands at teh end recreate the directory for you.

    >>md "C:\Documents and Settings\Owner\Local Settings\Temp\ "
    >>md c:\temp

    and the difference here is that the top example has spaces in the filename. Anytime you reference a path in windows that contains a space it must be enclosed in " " otherwise windows thinks that the rest of the typing after the space is an executable argument.

    EDIT: darn 5 mins too slow
     
    Last edited: 2003/02/13
  18. 2003/02/13
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    Thanks anyway terrafutan , If I had known you were going to show up today, I could have slept in. :D
     
  19. 2003/02/13
    Dennis L Lifetime Subscription

    Dennis L Inactive Alumni

    Joined:
    2002/06/07
    Messages:
    2,557
    Likes Received:
    2
    To the both of you, thank you kindly.
     
  20. 2003/02/21
    jslow

    jslow Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    377
    Likes Received:
    0
    Hi Zephyr,
    I tried to add the following to the batch file but can't seem to get it to delete the files in this folder:

    echo y | rd/s "C:\Documents and Settings\User\My Recent Documents\ "
    md "C:\Documents and Settings\User\My Recent Documents\ "

    Did I do something wrong?
    Thanks
     
  21. 2003/02/21
    Zephyr

    Zephyr Inactive

    Joined:
    2002/01/21
    Messages:
    1,519
    Likes Received:
    0
    If you just want to dump the contents, use the command:

    echo y | del "C:\Documents and Settings\User\My Recent Documents\*.* "

    I use the other command as you posted only when needing to delete any possible hierarchy structure that may or may not be inside the target folder. That doesn't likely apply to your target folder.

    tip: Any time you are testing a batch script and want to see what went wrong, insert the PAUSE command as the final line. Then the script and all error messages will stay on screen for you to review. Sometimes it may even be necessary to insert a pause command between each line to localize a problem since often times the batch is prematurely terminated when the error occurs and never gets to the end PAUSE line.
     
    Last edited: 2003/02/21
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.