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.

Resolved command line to delete folder contents

Discussion in 'Windows 7' started by Sebastian42, 2012/08/05.

  1. 2012/08/16
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    "C:\Users\username\AppData\Local\Microsoft\Windows\Temporary Internet Files "
     
  2. 2012/08/16
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    Running it from within Windows (with admin priv.) works partly (it leaves the index.dat file in the /Content.IE5 folder).

    Having it run from the startup folder as I did works 100%.
     

  3. to hide this advert.

  4. 2012/08/16
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    Interesting result : after reboot the TIF folder was there (without starting I.E.), but its contents were considerably reduced, and those items that survived could be deleted manually (something I knew from the outset). The nine survivors were NOT all newly created, because the date stamp of some predated 'today' viz : 16/08/2012 11:56 PM
    16/08/2012 11:56 PM
    16/08/2012 11:56 PM
    16/08/2012 11:07 PM
    12/08/2012 8:39 PM
    16/08/2012 8:26 PM
    14/08/2012 8:04 PM
    16/08/2012 3:56 PM
    16/08/2012 11:02 PM

    All a bit of a mystery ! - BUT a solution of sorts !
     
  5. 2012/08/16
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Other software *may* use the TIF directory as well as IE. For example, Skype will use it as well as Google Chrome. Other apps use it too. If such is the case, deleting certain files, or deleting the directory itself will fail, even in a bat file run as Admin within Windows.

    No need to be concerned about the TIF directory being created after its removal. ANY programs that try to use it will force Windows to create it.
     
  6. 2012/08/16
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    Thank you - what I now have looks like the best I can hope for - and it is adequate. I have done two more reboots and checked the contents of TIF folder and each time found a variety of time stamps (4 ?) but of less than 24 hours ago. However some 'called' cookies have an earlier timestamp than the TIF folder, as though they were kept aside until the TIF folder was recreated and then popped in ! What an interesting adventure this has been !
     
  7. 2012/08/17
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Get rid of cookies as well:
    Code:
    @echo off
    taskkill /f /im explorer.exe
    rd /S/q  "C:\Users\[B]YOURusername[/B]\AppData\Roaming\Microsoft\Windows\Cookies "
    rd /S/q  "C:\Users\[B]YOURusername[/B]\AppData\Local\Microsoft\Windows\Temporary Internet Files "
    start explorer.exe
    Cookies get stored in the Cookies dir as well as the TIF dir. Preserved Website Data is stored in the TIF dir. To better manage cookies, go to Internet Options > General Tab > Browsing history > Dedlete button > remove checkmark next to Preserve Favorites website data > Delete button. (you only need do this once)

    Then do Privacy tab > Advanced button > checkmark Override auto cookie handling > Third party cookies > Block.

    Add these to the above bat file (before start explorer.exe) for further cleanup:
    Code:
    rd /S/q  "C:\Users\[B]YOURusername[/B]\AppData\Local\Temp "
    md   "C:\Users\[B]YOURusername[/B]\AppData\Local\Temp "
    rd /S/q  "C:\Users\[B]YOURusername[/B]\AppData\Local\Microsoft\Windows\History "
     
  8. 2012/08/17
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    Preliminary response :
    My aim was to empty the contents of Temporary Internet Files folder. The cookies that YOU suggest are NOT in that folder, but in \Windows\.

    Even if I got rid of the freshly created cookies form the TIF folder, that would still leave some other 'objects', that do not have the typical file format of FILENAME.EXT

    I will experiment with the rest of your suggestions, Tony and report back.

    Incidentally - if the batch needs to be run 'as administrator', and it runs automatically from StartUP, does that imply that StartUp runs 'as Administrator' ?
     
  9. 2012/08/17
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    2nd response - I made a batch of

    @echo off
    taskkill /f /im explorer.exe
    rd /S/q "C:\Users\YOURusername\AppData\Local\Microsoft\Windows\Temporary Internet Files "
    start explorer.exe

    and put in in startup and rebooted.
    It had less effect than

    rd /S/q "C:\Users\Joe\AppData\Local\Microsoft\Windows\Temporary Internet Files "

    Seems to me I should be content with the latter code.
     
  10. 2012/08/17
    Steve R Jones

    Steve R Jones SuperGeek Staff

    Joined:
    2001/12/30
    Messages:
    12,315
    Likes Received:
    252
    In the for what it's worth category, I use the IE Advanced option-> "Delete Temp Files when Browser is Closed."

    No fuss no muss;)
     
  11. 2012/08/17
    PeteC

    PeteC SuperGeek Staff

    Joined:
    2002/05/10
    Messages:
    28,896
    Likes Received:
    389
    From my experience with the same settings this does not clear all TIF's, only the current session maybe. Some hang around as seen in CCcleaner set only for TIF's which show several megs of files .....
     

    Attached Files:

    • TIF.JPG
      TIF.JPG
      File size:
      87.6 KB
      Views:
      5
  12. 2012/08/17
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    I.E. is NOT my default browser - so that might be ineffective FOR ME.

    My query was about correct code for a batch file, as distinct from 'How can I empty the TIF folder ?'

    My recent experimenting with suggestions in this thread has convinced me the whole issue is VERY complex; but a quite satisfactory solution is, I repeat, a batch file in the StartUp folder - which has the following code :

    rd /S/q "C:\Users\UserName\AppData\Local\Microsoft\Windows\Temporary Internet Files "

    ADDENDUM
    The autoregeneration of content in TIF folder, suggests that there should be an option to allow only some 'entities' to create files there, rather than have aggressive sites (or whatever) populating the TIF folder at will. It all consumes resources, which is wasteful when an owner just keeps deleting them as soon as they form.
     
    Last edited: 2012/08/17
  13. 2012/08/18
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    If you are satisfied at this point, please mark the thread as "Resolved ".
    Browser settings in IE and Chrome will limit the amount of data stored in the TIF dir. In both IE and Chrome, one can select to not store 3rd party cookies and site preferences, though site preferences is worth retaining sometimes.

    Using the bat file once/week should suffice, the resources consumed are very minimal and the space consumed is tiny. Besides, resources are for use, today's computers have plenty to use.
     
  14. 2012/08/18
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    I'm happy to mark the thread as 'resolved', if only I could find a way to do it. No doubt you will reply and show me how; but you should take my quandary as evidence that the procedure you want posters to do, is NOT obvious.

    Since I use both I.E. and Chrome only if I NEED to, your advice about them is not likely to 'hit the mark'. I have noticed that (amongst others) a PC-to-CP program I use and want to keep launched, creates the lion's share of the regenerated 'objects' in the TIF folder.
     
  15. 2012/08/18
    PeteC

    PeteC SuperGeek Staff

    Joined:
    2002/05/10
    Messages:
    28,896
    Likes Received:
    389
    It is quite straightforward - Thread Tools .....


    Please mark your thread as 'Resolved'.

     
  16. 2012/08/18
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    One last thing I discovered while testing the bat file(s):

    Whether using the complete bat I posted or just the line to rd the TIF dir, the TIF won't actually get removed and recreated UNLESS certain processes that are using that dir are killed first. You can see this for yourself by adding the pause command before starting explorer.exe. (you'll see the error message and the prompt to continue.
    Code:
    @echo off
    taskkill /f /im explorer.exe
    rd /S/q  "C:\Users\YOURusername\AppData\Local\Microsoft\Windows\Temporary Internet Files "
    pause
    start explorer.exe
    I discovered what processes use the TIF dir by downloading and running Microsoft's Process Explorer.

    Run Process Explorer and use the Find menu and search for "index.dat ". All processes using the index.dat files will get listed. In my case, the 2 processes using those files are explorer.exe and sidebar.exe. I have the weather gadget in my sidebar and it uses the TIF dir to store its various connection data.

    I added lines to the bat file...
    Code:
    @echo off
    taskkill /f /im explorer.exe
    taskkill /f /im sidebar.exe
    rd /S/q  "C:\Users\YOURusername\AppData\Local\Microsoft\Windows\Temporary Internet Files "
    pause
    start explorer.exe
    start sidebar.exe
    ...but still the TIF dir did not get removed, the weather widget was still using the TIF dir.

    So I added an additional pause:
    Code:
    @echo off
    taskkill /f /im explorer.exe
    taskkill /f /im sidebar.exe
    pause
    rd /S/q  "C:\Users\YOURusername\AppData\Local\Microsoft\Windows\Temporary Internet Files "
    pause
    start explorer.exe
    start sidebar.exe
    ...and the TIF dir was completely removed and recreated newly. You can verify this by access the folder properties and viewing its creation data and time.

    Without the additional pause after killing sidebar.exe, the rd command initiates PRIOR to sidebar fully terminating. It's just too darn fast! The pause at that point ensures sidebar.exe fully terminates, after which the TIF dir can be completely removed along with ALL of its contents.

    Note:
    If Process Explorer shows that other programs are using the index.dat files in the TIF dir, then use taskkill to end those processes and use start to get 'em going again.

    Additional:
    There's one other caveat, Windows Search service and Indexing may interfere, as they too may be using the dirs that one wishes to remove. I have those services completely disabled on my system as they are pretty useless for me anyway. Here's how to disable them and still use Search via the Start Menu:
     
  17. 2012/08/18
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    Thank you for that very extensive farewell package. Since I have achieved my aim, I will NOT look for extra work in trying the task-kill again; but I note with interest various points you have made, in particular about Process Explorer - that must be a glorified Task Manager
     
  18. 2012/08/18
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    You're welcome. (we REALLY aim to please here at windowsbbs.com!)

    Process Explorer is free and can be very useful at times. By the way, there are several other related utilities by the same developers at Microsoft who started with SysInternals company.
     
  19. 2012/12/04
    Sebastian42

    Sebastian42 Well-Known Member Thread Starter

    Joined:
    2008/11/25
    Messages:
    84
    Likes Received:
    0
    I have found that TFCleaner by Old Timer will empty the TIF folder (and others too).
     

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.