Find and Copy
Results 1 to 9 of 9

Thread: Find and Copy

  1. #1
    Join Date
    Jun 2000
    Posts
    332

    Find and Copy

    Hi,

    Need an urgent help on finding and copying.


    I need to copy 2 cookie files from many PCs. Wish to create a batch program.

    1) It must be able to search for the cookie file '*@rls*.txt' in both the c:\windows\cookies and the c:\windows\profiles folder.

    2) Once it finds the files, it should copy them to the a temp folder.

    3) Aftwhich, should delete all the other contents in the both folders.

    4) Copy back the '*@rls*.txt' files to their original respective locations.

    Pls help. Thanks!
    EveryONe I daTe alw@ys turns out to be sUCh a cyborg.

  2. #2
    Join Date
    Apr 2002
    Posts
    1,840
    This should work.

    1 md c:\windows\temp\cookies
    2 md c:\windows\temp\profiles
    3 IF EXIST c:\windows\cookies\*@rls*.txt copy c:\windows\cookies\*@rls*.txt c:\windows\temp\cookies
    4 IF EXIST c:\windows\profiles\*@rls*.txt copy c:\windows\profiles\*@rls*.txt c:\windows\temp\profiles
    5 del c:\windows\cookies\*.txt
    6 del c:\windows\profiles\*.txt
    7 copy c:\windows\temp\cookies\*.* c:\windows\cookies
    8 copy c:\windows\temp\profiles\*.* c:\windows\profiles
    9 deltree /y c:\windows\temp\cookies
    10 deltree /y c:\windows\temp\profiles
    Last edited by markp62; February 24th, 2003 at 11:32 PM.

  3. #3
    Join Date
    Jun 2000
    Posts
    332

    Unhappy

    hi markp62 ,

    thanks for the info. but i got a bit of a problem here.
    the directory c:\windows\profiles\ contains many other folder, for eg.

    c:\windows\profiles\david
    c:\windows\profiles\john
    c:\windows\profiles\peter
    c:\windows\profiles\mike

    each of these folders might or might not contain the cookie file. and these profiles\sub-folders vary from PC to PC.

    Pls help.
    EveryONe I daTe alw@ys turns out to be sUCh a cyborg.

  4. #4
    Join Date
    Apr 2002
    Posts
    1,840
    Well, you've got a good template to edit. All you need to do is add those in. For example the second line would be duplicated 4 times and edited as follows
    md c:\windows\temp\profiles\david <edit name and do the next one

    The fourth line the same.
    IF EXIST c:\windows\profiles\david\*@rls*.txt copy c:\windows\profiles\david\*@rls*.txt c:\windows\temp\profiles\david

    Then do the same for the eighth line.

    Leave the last two lines alone. Leave out the line numbers, though.
    Last edited by markp62; February 24th, 2003 at 11:33 PM.

  5. #5
    Join Date
    Jun 2000
    Posts
    332
    thanks for the help markp62!
    it works!
    EveryONe I daTe alw@ys turns out to be sUCh a cyborg.

  6. #6
    Join Date
    Apr 2002
    Posts
    1,840
    Cool, and thanks for posting back.

  7. #7
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    Here's a different approach. It does NOT require knowing what names are listed under "C:\Windows\Profiles" but, it does require Windows 9x/Me and having DEBUG.EXE somwhere in your PATH:
    Code:
    @echo off
    cls
    echo @echo on>~.bat
    echo cls>>~.bat
    echo Searching for all cookie files except "*@rls*.txt" in:
    echo.
    echo C:\Windows\Cookies ...
    dir/a/b/s c:\windows\cookies|find/i "\cookies\"|find/v/i "@rls">>~.bat
    echo C:\Windows\Profiles\{whomever}\Cookies ...
    dir/a/b/s c:\windows\profiles|find/i "\cookies\"|find/v/i "@rls">>~.bat
    echo nchange.com>~.scr
    echo e100 e9 86 00 00 00 00 00 00 00 00 53 79 6e 74 61 78>>~.scr
    echo e110 20 65 72 72 6f 72 24 46 69 6c 65 20 6e 6f 74 20>>~.scr
    echo e120 66 6f 75 6e 64 24 46 69 6c 65 20 74 6f 6f 20 62>>~.scr
    echo e130 69 67 24 4e 6f 74 20 43 68 61 6e 67 65 64 24 43>>~.scr
    echo e140 6f 70 79 72 69 67 68 74 20 31 39 38 36 20 5a 69>>~.scr
    echo e150 66 66 2d 44 61 76 69 73 20 50 75 62 6c 69 73 68>>~.scr
    echo e160 69 6e 67 20 43 6f 2e 1a 50 72 6f 67 72 61 6d 6d>>~.scr
    echo e170 65 64 20 62 79 20 4d 69 63 68 61 65 6c 20 4a 2e>>~.scr
    echo e180 20 4d 65 66 66 6f 72 64 1a be 80 00 ba 0a 01 fc>>~.scr
    echo e190 e8 35 01 89 36 03 01 80 3c 0d 74 3f 80 3c 20 74>>~.scr
    echo e1a0 03 46 eb f3 c6 04 00 e8 1e 01 33 c9 bf e1 02 e8>>~.scr
    echo e1b0 d7 00 80 3c 20 74 08 80 3c 0d 74 1f 46 eb f0 e8>>~.scr
    echo e1c0 06 01 89 0e 05 01 33 c9 bf 61 03 e8 bb 00 80 3c>>~.scr
    echo e1d0 20 74 0e 80 3c 0d 74 09 46 eb f0 b4 09 cd 21 cd>>~.scr
    echo e1e0 20 89 0e 07 01 8b 16 03 01 b8 00 3d cd 21 ba 17>>~.scr
    echo e1f0 01 72 e8 8b d8 ba 01 52 b9 40 9c b4 3f cd 21 ba>>~.scr
    echo e200 26 01 3d 40 9c 74 d4 50 b4 3e cd 21 5a a1 05 01>>~.scr
    echo e210 3b d0 7d 05 ba 33 01 eb c2 bb 01 52 b8 e1 03 be>>~.scr
    echo e220 e1 02 8b fb 8b 0e 05 01 f3 a6 8b f8 74 08 8b f3>>~.scr
    echo e230 a4 40 43 4a eb 18 80 0e 09 01 01 be 61 03 8b 0e>>~.scr
    echo e240 07 01 03 c1 03 1e 05 01 2b 16 05 01 f3 a4 3b 16>>~.scr
    echo e250 05 01 7d cb 8b ca 03 c1 8b f3 f3 a4 50 8b 16 03>>~.scr
    echo e260 01 33 c9 b4 3c cd 21 59 81 e9 e1 03 8b d8 ba e1>>~.scr
    echo e270 03 b4 40 cd 21 b4 3e cd 21 ba 33 01 80 3e 09 01>>~.scr
    echo e280 00 74 03 83 c2 04 e9 52 ff 80 3c 22 75 14 46 ac>>~.scr
    echo e290 3c 0d 74 31 3c 22 75 06 e8 34 00 73 01 c3 aa 41>>~.scr
    echo e2a0 eb ed 32 db e8 28 00 73 05 8a c3 aa 41 c3 ac 3c>>~.scr
    echo e2b0 30 72 12 3c 39 77 0e 2c 30 8a f8 b0 0a f6 e3 8a>>~.scr
    echo e2c0 d8 02 df eb df e9 13 ff 46 80 3c 20 74 fa c3 f8>>~.scr
    echo e2d0 80 3c 20 74 0a 80 3c 0d 74 05 80 3c 2c 75 01 f9>>~.scr
    echo e2e0 c3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e2f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e370 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e3a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e3b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e3c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e3d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>>~.scr
    echo e3e0 00>>~.scr
    echo rcx>>~.scr
    echo 2e1>>~.scr
    echo w>>~.scr
    echo q>>~.scr
    debug<~.scr>nul
    change ~.bat "C:\" "del ",34,"C:\"
    change ~.bat 13,10 34,13,10
    echo.
    echo Deleting found files ...
    for %%x in (call del) do %%x ~.bat
    for %%x in (~.scr change.com) do del %%x
    echo.
    echo Done.
    Note: If you do NOT want to see the name of every cookie file being deleted, change the third line from:
    • echo @echo on>~.bat
    to:
    • echo @echo off>~.bat
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

  8. #8
    Join Date
    Jun 2000
    Posts
    332
    WOW!

    That's wonderful. Really cool.
    Works like an wonder.

    Thanks Vernon Frazee!
    EveryONe I daTe alw@ys turns out to be sUCh a cyborg.

  9. #9
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    You're more than Welcome. Thanks for posting back.
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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