del *.* except one thing
Results 1 to 11 of 11

Thread: del *.* except one thing

  1. #1
    Registered User
    Join Date
    Oct 2001
    Location
    outside philly
    Posts
    84

    del *.* except one thing

    heres what im looking to do

    we run a purge script to nuke cookies & the like on reboot or shut down

    each user has a cookie to there jupiter/meridius quarantine list for email spam

    the cookie is called username@webmin[2]

    my goal here is kill/nuke/purge all temp & cookie crap except that cookie

    here is the script we are using to kill cookies for all accounts on a workstation:
    for /D %%d in ("C:\Documents and Settings\*.*") do deltree /y "%%d\cookies\*.*"

    i had the idea to copy the cookie out then copy the cookie back in but not for all users & have it return to the right spot

    there is no except tab with either deltree or del that i could find

    as always many thanks in advance

  2. #2
    Registered User InTheWayBoy's Avatar
    Join Date
    Feb 2000
    Location
    Jacksonville, FL USA
    Posts
    435
    I don't know how you could do it with a script, but there is a program called Disk Cleaner that is pretty handy. You can configure what it should clean, and you can specify certain cookies to keep. Then, you run the program like this:

    diskcleaner.exe -preset

    It's not quite that simple, but the point I'm getting at is it would be very simple to integrate that into a logon script. And it's small and doesn't need to be installed, just call it from the server.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Location
    outside philly
    Posts
    84
    that lil util is kinda neat but wont do....
    ill splain

    win2k/xp

    seperate profiles
    each cookie starts with the name of the profile

    example
    username1@thecookieiwantokeep[2].txt
    username2@thecookieiwantokeep[2].txt
    username3@thecookieiwantokeep[2].txt
    username4@thecookieiwantokeep[2].txt
    username5@thecookieiwantokeep[2].txt

    And the location is gonna be
    c:\docs & settings\username1\cookies
    c:\docs & settings\username2\cookies
    c:\docs & settings\username3\cookies
    c:\docs & settings\username4\cookies
    c:\docs & settings\username5\cookies

    this would be much easier if deltree or del had an exclude switch like xcopy does...but whatev

  4. #4
    Registered User
    Join Date
    Jun 2001
    Posts
    46
    It's been a long time since i've used dos command line ( i prefer linux), but why don't you just modify your existing script a little bit by doing something like this:

    for /D %%d in ("C:\Documents and Settings\*.*")
    do
    move %PATH%\username1@thecookieiwantokeep[2].txt ..\tempcookies\
    deltree /y "%%d\cookies\*.*"
    move %PATH%\tempcookies\*.* ..\tempcookies
    ...
    whatever else you want to do...

    ...

    Would that work out for you?

  5. #5
    Registered User CrashNBurn79's Avatar
    Join Date
    Sep 2002
    Location
    Wichita, KS
    Posts
    30
    Ok here's the best solution for what you are doing.
    Download http://www.ccleaner.com/
    It has settings in the program that will allow you to choose which cookies you want to keep. You can also set it up to delete all that stuff when you restart your computer. It works with firefox and IE so you shouldn't have any problems there.

    Now was that so hard?
    Mess with the best, Die like the Rest.

  6. #6
    Registered User
    Join Date
    Oct 2004
    Posts
    15
    I tried this copying my CNN cookie out to the root of C and back again and it seemed to work.

    @echo off
    c:
    cd\
    cd %userprofile%
    cd cookies
    copy /y *.cnn[1].txt c:\
    del /f /q *.*
    copy /y c:\*.cnn[1].txt
    exit

  7. #7
    Registered User Vip2's Avatar
    Join Date
    Jul 2003
    Posts
    44

    Try This...

    This worked in my limited testing :

    mkdir c:\Cookie
    cd \Documents and Settings
    for /D %%d in (".\*.*") do copy "%%d\cookies\%%d@webmin[2]" c:\Cookie\*.*
    for /D %%d in (".\*.*") do rmdir /s/q "%%d\cookies"
    for /D %%d in (".\*.*") do mkdir "%%d\Cookies"
    for /D %%d in (".\*.*") do copy "c:\Cookie\%%d@webmin[2]" "%%d\cookies\*.*"
    rmdir /s/q c:\Cookie


    Sounds like you are asking this for use in a company. Remember to check the licenses if you decide to use one of those programs that were mentioned. Some are not free for use by a company.
    Last edited by Vip2; April 6th, 2005 at 06:35 PM.

  8. #8
    Registered User
    Join Date
    Oct 2001
    Location
    outside philly
    Posts
    84
    Quote Originally Posted by Vip2
    This worked in my limited testing :

    mkdir c:\Cookie
    cd \Documents and Settings
    for /D %%d in (".\*.*") do copy "%%d\cookies\%%d@webmin[2]" c:\Cookie\*.*
    for /D %%d in (".\*.*") do rmdir /s/q "%%d\cookies"
    for /D %%d in (".\*.*") do mkdir "%%d\Cookies"
    for /D %%d in (".\*.*") do copy "c:\Cookie\%%d@webmin[2]" "%%d\cookies\*.*"
    rmdir /s/q c:\Cookie


    Sounds like you are asking this for use in a company. Remember to check the licenses if you decide to use one of those programs that were mentioned. Some are not free for use by a company.



    i tried this & it doesnt seem to work

    what os? im trying to do this in xp pro

  9. #9
    Registered User Vip2's Avatar
    Join Date
    Jul 2003
    Posts
    44
    Quote Originally Posted by MAXIMUS2111-SPQR
    i tried this & it doesnt seem to work

    what os? im trying to do this in xp pro
    Windows 2000.
    Did they change that much in XP?
    Are you using a ".CMD" file or a ".BAT"? It needs to be a ".CMD".
    I do not have a XP installation at work so I cannot test it.

  10. #10
    Registered User
    Join Date
    Oct 2001
    Location
    outside philly
    Posts
    84
    aha that could be it right there
    lemme give it a shot

  11. #11
    Registered User
    Join Date
    Oct 2001
    Location
    outside philly
    Posts
    84
    we got a winner jonny

    thanks vip you rule

Similar Threads

  1. I saw a HORRIBLE thing today.
    By gxavier in forum Tech Lounge & Tales
    Replies: 55
    Last Post: January 23rd, 2002, 12:04 PM
  2. Replies: 1
    Last Post: October 3rd, 2001, 03:54 AM
  3. Whats the CRAZIEST or EXCITING thing you have done???
    By [NeoZeeD] in forum Tech Lounge & Tales
    Replies: 22
    Last Post: July 5th, 2001, 06:44 AM
  4. The only thing I wasn't ready for
    By jaeger in forum Tech Lounge & Tales
    Replies: 16
    Last Post: May 18th, 2001, 06:35 AM
  5. Phobias - or thing that make you twitch
    By NooToo in forum Tech Lounge & Tales
    Replies: 48
    Last Post: May 7th, 2001, 07:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •