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.

Delete & remake empty text files

Discussion in 'Windows XP' started by wahlroot, 2005/08/30.

  1. 2005/08/30
    wahlroot

    wahlroot Inactive Thread Starter

    Joined:
    2002/08/15
    Messages:
    546
    Likes Received:
    1
    I have a Batch File that deletes some text files in some applications. These empty text files are remade when the application is started. This slows the application startup. I would like to have the empty text files remade by the batch file during bootup. Is this possible. If so, how.
     
  2. 2005/08/30
    markp62

    markp62 Geek Member Alumni

    Joined:
    2002/05/01
    Messages:
    4,012
    Likes Received:
    16
    It would be easy to have a blank file handy, then use the copy command to create new blank files with a different name. Have this blank file in the same folder where you want the new ones created, for a shorter command line.
    copy c:\path\filename.ext newname1.ext
    copy c:\path\filename.ext newname2.ext

    Or a one line way.
    for %%c in (newname1 newname2) do copy c:\path\filename.ext %%c.ext
     

  3. to hide this advert.

  4. 2005/08/30
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Would it work to substitute markp62's strings to copy/overwrite with the blank files rather than your batch file to delete them? It should be about the same speed as your deleting them and would avoid having to use a seperate operation to create new empty ones.
     
    Newt,
    #3
  5. 2005/08/31
    wahlroot

    wahlroot Inactive Thread Starter

    Joined:
    2002/08/15
    Messages:
    546
    Likes Received:
    1
    I guess I still do not know what I am doing. I put a line in my batch file as follows.
    copy "C:\Folder\File.dat C:\PROGRA~1\Application "
    This did not replace the file. If I put a line in as follows, it deletes the file.
    DEL /s /q "C:\PROGRA~1\Application\File.dat "
     
  6. 2005/08/31
    oshwyn5

    oshwyn5 Inactive

    Joined:
    2005/08/25
    Messages:
    736
    Likes Received:
    0
    Are you worrying about index.dat files?
    Normally if you delete the contents of a folder which has an index.dat file , the index.dat retains a list of what was ther UNTIL YOU REBOOT or something new is saved to that folder at which point the index.dat is rewritten.
    Using a batch file to delete index.dat files is just redundant.
    You are deleting something which will be overwritten anyhow.

    It is a misconception based on problems IE 4 had back in the win95 days when it did not overwrite the index.dat, but appended the new one . This is no longer a problem.
     
  7. 2005/08/31
    wahlroot

    wahlroot Inactive Thread Starter

    Joined:
    2002/08/15
    Messages:
    546
    Likes Received:
    1
    These are not index.dat files. These are .dat files in Opera browser. they maintain History of web sites visited. I delete them with a batch file on bootup.
     
  8. 2005/08/31
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    copy "C:\Folder\File.dat C:\PROGRA~1\Application "

    Hmmmm. If that string found an existing file it would probably ask you about overwriting it and for some reason you may not be see that prompt message. Try adding /Y to force a silent overwrite (so it doesn't ask).

    copy "C:\Folder\File.dat C:\PROGRA~1\Application" /Y
     
    Newt,
    #7
  9. 2005/08/31
    wahlroot

    wahlroot Inactive Thread Starter

    Joined:
    2002/08/15
    Messages:
    546
    Likes Received:
    1
    No Newt. I tried what you suggested (add /y ) at the end. It did not work. Also, I tried xcopy at the start. Did not work. I saw that somewhere.
     
  10. 2005/09/01
    markp62

    markp62 Geek Member Alumni

    Joined:
    2002/05/01
    Messages:
    4,012
    Likes Received:
    16
    I think the problem you are running across is file attributes, and dos commands. Index.Dat typically has a Hidden attribute, and dos isn't supposed to "see" it. So a plain DEL command does nothing.
    One way to make sure you can delete a file is use these two commands with XP's Cmd.Exe.
    attrib -r -s -h c:\path\filename.ext
    del c:\path\filename.ext

    With a 9x/ME system you could use this command. While I included the /y, it generally is a good idea when manually using this command to omit it, as deltree will take out a folder before you know it due to a typo. It is fine for a BAT file.
    deltree /y c:\path\filename.ext
    As far as what you are trying to do, these should work for you.
    copy /y C:\Folder\File.dat C:\PROGRA~1\Application\index.dat
    copy /y C:\Folder\File.dat C:\PROGRA~1\Application\index.dat
     
  11. 2005/09/01
    wahlroot

    wahlroot Inactive Thread Starter

    Joined:
    2002/08/15
    Messages:
    546
    Likes Received:
    1
    OK I made my batch file lines as follows, and it seems to work. Replaces the .dat files with other empty ones I had placed in the C:\folder. I had to remove the quotation marks before C and afterApplication. do not know why.
    copy /y C:\Folder\File.dat C:\PROGRA~1\Application
    Thanks for all the help.
     
  12. 2005/09/02
    oshwyn5

    oshwyn5 Inactive

    Joined:
    2005/08/25
    Messages:
    736
    Likes Received:
    0
    Same basic thing. Why not just use the opera built in delete private data option?
    Unless you use an eraser program to shred them, you might as well just use the programs own cleanup option and count on the contents being automatically overwritten when you reuse them.
     
  13. 2005/09/02
    wahlroot

    wahlroot Inactive Thread Starter

    Joined:
    2002/08/15
    Messages:
    546
    Likes Received:
    1
    I have Opera set to "Empty" and "Delete" on exit everywhere I can find it. Still have files that are full after exit.
     

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.