How to clear content of a lot of text files fast under Windows












1















I have folder with logs.



This folder contains a lot of log files. I cannot delete these files because server keep it. But I can remove content of every file. It is very annoying to open each file and remove content.



Can you provide ideas to make it faster?










share|improve this question




















  • 2





    What OS are you using?

    – aphoria
    Oct 22 '14 at 11:25











  • You want something like for f in *.log; do :>"$f"; done or the Windows equivalent.

    – AFH
    Oct 22 '14 at 11:26













  • I use Wnidows OS

    – gstackoverflow
    Oct 22 '14 at 11:37











  • What's Wnidows OS?

    – Little Helper
    Oct 22 '14 at 11:44











  • I use Windows 7

    – gstackoverflow
    Oct 22 '14 at 11:45
















1















I have folder with logs.



This folder contains a lot of log files. I cannot delete these files because server keep it. But I can remove content of every file. It is very annoying to open each file and remove content.



Can you provide ideas to make it faster?










share|improve this question




















  • 2





    What OS are you using?

    – aphoria
    Oct 22 '14 at 11:25











  • You want something like for f in *.log; do :>"$f"; done or the Windows equivalent.

    – AFH
    Oct 22 '14 at 11:26













  • I use Wnidows OS

    – gstackoverflow
    Oct 22 '14 at 11:37











  • What's Wnidows OS?

    – Little Helper
    Oct 22 '14 at 11:44











  • I use Windows 7

    – gstackoverflow
    Oct 22 '14 at 11:45














1












1








1


0






I have folder with logs.



This folder contains a lot of log files. I cannot delete these files because server keep it. But I can remove content of every file. It is very annoying to open each file and remove content.



Can you provide ideas to make it faster?










share|improve this question
















I have folder with logs.



This folder contains a lot of log files. I cannot delete these files because server keep it. But I can remove content of every file. It is very annoying to open each file and remove content.



Can you provide ideas to make it faster?







windows-7 windows logging






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 22 '14 at 18:41









Kevin Panko

5,919113648




5,919113648










asked Oct 22 '14 at 11:22









gstackoverflowgstackoverflow

159313




159313








  • 2





    What OS are you using?

    – aphoria
    Oct 22 '14 at 11:25











  • You want something like for f in *.log; do :>"$f"; done or the Windows equivalent.

    – AFH
    Oct 22 '14 at 11:26













  • I use Wnidows OS

    – gstackoverflow
    Oct 22 '14 at 11:37











  • What's Wnidows OS?

    – Little Helper
    Oct 22 '14 at 11:44











  • I use Windows 7

    – gstackoverflow
    Oct 22 '14 at 11:45














  • 2





    What OS are you using?

    – aphoria
    Oct 22 '14 at 11:25











  • You want something like for f in *.log; do :>"$f"; done or the Windows equivalent.

    – AFH
    Oct 22 '14 at 11:26













  • I use Wnidows OS

    – gstackoverflow
    Oct 22 '14 at 11:37











  • What's Wnidows OS?

    – Little Helper
    Oct 22 '14 at 11:44











  • I use Windows 7

    – gstackoverflow
    Oct 22 '14 at 11:45








2




2





What OS are you using?

– aphoria
Oct 22 '14 at 11:25





What OS are you using?

– aphoria
Oct 22 '14 at 11:25













You want something like for f in *.log; do :>"$f"; done or the Windows equivalent.

– AFH
Oct 22 '14 at 11:26







You want something like for f in *.log; do :>"$f"; done or the Windows equivalent.

– AFH
Oct 22 '14 at 11:26















I use Wnidows OS

– gstackoverflow
Oct 22 '14 at 11:37





I use Wnidows OS

– gstackoverflow
Oct 22 '14 at 11:37













What's Wnidows OS?

– Little Helper
Oct 22 '14 at 11:44





What's Wnidows OS?

– Little Helper
Oct 22 '14 at 11:44













I use Windows 7

– gstackoverflow
Oct 22 '14 at 11:45





I use Windows 7

– gstackoverflow
Oct 22 '14 at 11:45










3 Answers
3






active

oldest

votes


















0














From a command line:



FOR /R C:YourFolder %f IN (*.LOG) DO TYPE NUL>%f


Or, from a batch file:



FOR /R C:YourFolder %%f IN (*.LOG) DO TYPE NUL>%%f





share|improve this answer
























  • The process cannot access the file because it is being used by another process.

    – gstackoverflow
    Oct 22 '14 at 12:19






  • 1





    How you clearing it manually?

    – aphoria
    Oct 22 '14 at 12:22











  • I open this file using notepade++ and clear content and save file

    – gstackoverflow
    Oct 22 '14 at 12:59








  • 1





    If another process has the file locked, I'm not sure how you can be clearing and saving it.

    – aphoria
    Oct 22 '14 at 16:56






  • 1





    I have tried a lot of methods on this and they all involve doing quite a lot of work (installing software or programming). Your simplest answer is to boot into safe mode (command-line only) and the above solutions should work. This will be fine for a one-off, though not something to do regularly. I tried NP++ on a file held open for writing and got an error, effectively the same as you saw, so I don't know how it works for you. Which logs are you talking about?

    – AFH
    Oct 22 '14 at 17:00



















0














Just a thought if the file is being used and you can't clear it, and notepad ++ is allowing you to clear it why not just use a script in notepad++ like @Dhiwakar Ravikumar mentioned? If Scripts are out of the question, and assuming you have quite a bit of log files, why not just open them all in notepad++, Select the first open tab and hit Ctrl + A, then Delete key, Then Ctrl + S, then Ctrl + W? That would select all the text in the file, Delete it, Save the file, Then close it and then just do the same thing. (Like a Script)






share|improve this answer































    0














    Save the below code as a batch file and Run it.



    You can save the trouble of typing the command everytime :).



    Change M:Newfolder & *.txt to reflect your path & log file extension respectively.



    @ECHO OFF 
    setlocal EnableDelayedExpansion
    FOR /R M:Newfolder %%G IN (*.txt) DO (
    TYPE nul > %%G
    )
    pause


    UPDATE



    You can try to create a Macro to automate what you want to do.



    Check out the first answer provided by ellak here



    Open all your Log Files at once and then Run this Macro Everytime.



    If you want to automate even that (opening all your Log Files at once) then Run the Batch Script below.



    @ECHO OFF 
    setlocal EnableDelayedExpansion
    FOR /R M:Newfolder %%G IN (*.txt) DO (
    notepad++.exe %%G
    )
    pause


    So the next time you want to clear your Log Files, Simply
    1. Run the Batch Script provided
    2. Run the Macro from Notepad++



    There is a way to run them both from the same script but this requires NPPExec Plugins that I'm not too familiar with. Please let me know if you want it with the plugin or if the solution provided above will suffice.






    share|improve this answer


























    • The process cannot access the file because it is being used by another process

      – gstackoverflow
      Oct 22 '14 at 12:22











    • That means the file is being used. You can't clear the contents of a file that you have opened (in notepad or some other application)

      – Dhiwakar Ravikumar
      Oct 22 '14 at 12:23











    • At this moment I can open this file using notepade++ and clear content and save file

      – gstackoverflow
      Oct 22 '14 at 12:58








    • 1





      I thought the purpose of asking the question was to avoid doing it manually. Please try to find out the Application using these Logs. End it and run the script again.

      – Dhiwakar Ravikumar
      Oct 22 '14 at 13:36











    • Yes, I want to avoid make it manually. Application server keep these logs files. And I don't want to stop it. hotepade ++ allow this

      – gstackoverflow
      Oct 22 '14 at 13:45











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f830000%2fhow-to-clear-content-of-a-lot-of-text-files-fast-under-windows%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    From a command line:



    FOR /R C:YourFolder %f IN (*.LOG) DO TYPE NUL>%f


    Or, from a batch file:



    FOR /R C:YourFolder %%f IN (*.LOG) DO TYPE NUL>%%f





    share|improve this answer
























    • The process cannot access the file because it is being used by another process.

      – gstackoverflow
      Oct 22 '14 at 12:19






    • 1





      How you clearing it manually?

      – aphoria
      Oct 22 '14 at 12:22











    • I open this file using notepade++ and clear content and save file

      – gstackoverflow
      Oct 22 '14 at 12:59








    • 1





      If another process has the file locked, I'm not sure how you can be clearing and saving it.

      – aphoria
      Oct 22 '14 at 16:56






    • 1





      I have tried a lot of methods on this and they all involve doing quite a lot of work (installing software or programming). Your simplest answer is to boot into safe mode (command-line only) and the above solutions should work. This will be fine for a one-off, though not something to do regularly. I tried NP++ on a file held open for writing and got an error, effectively the same as you saw, so I don't know how it works for you. Which logs are you talking about?

      – AFH
      Oct 22 '14 at 17:00
















    0














    From a command line:



    FOR /R C:YourFolder %f IN (*.LOG) DO TYPE NUL>%f


    Or, from a batch file:



    FOR /R C:YourFolder %%f IN (*.LOG) DO TYPE NUL>%%f





    share|improve this answer
























    • The process cannot access the file because it is being used by another process.

      – gstackoverflow
      Oct 22 '14 at 12:19






    • 1





      How you clearing it manually?

      – aphoria
      Oct 22 '14 at 12:22











    • I open this file using notepade++ and clear content and save file

      – gstackoverflow
      Oct 22 '14 at 12:59








    • 1





      If another process has the file locked, I'm not sure how you can be clearing and saving it.

      – aphoria
      Oct 22 '14 at 16:56






    • 1





      I have tried a lot of methods on this and they all involve doing quite a lot of work (installing software or programming). Your simplest answer is to boot into safe mode (command-line only) and the above solutions should work. This will be fine for a one-off, though not something to do regularly. I tried NP++ on a file held open for writing and got an error, effectively the same as you saw, so I don't know how it works for you. Which logs are you talking about?

      – AFH
      Oct 22 '14 at 17:00














    0












    0








    0







    From a command line:



    FOR /R C:YourFolder %f IN (*.LOG) DO TYPE NUL>%f


    Or, from a batch file:



    FOR /R C:YourFolder %%f IN (*.LOG) DO TYPE NUL>%%f





    share|improve this answer













    From a command line:



    FOR /R C:YourFolder %f IN (*.LOG) DO TYPE NUL>%f


    Or, from a batch file:



    FOR /R C:YourFolder %%f IN (*.LOG) DO TYPE NUL>%%f






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Oct 22 '14 at 11:48









    aphoriaaphoria

    828811




    828811













    • The process cannot access the file because it is being used by another process.

      – gstackoverflow
      Oct 22 '14 at 12:19






    • 1





      How you clearing it manually?

      – aphoria
      Oct 22 '14 at 12:22











    • I open this file using notepade++ and clear content and save file

      – gstackoverflow
      Oct 22 '14 at 12:59








    • 1





      If another process has the file locked, I'm not sure how you can be clearing and saving it.

      – aphoria
      Oct 22 '14 at 16:56






    • 1





      I have tried a lot of methods on this and they all involve doing quite a lot of work (installing software or programming). Your simplest answer is to boot into safe mode (command-line only) and the above solutions should work. This will be fine for a one-off, though not something to do regularly. I tried NP++ on a file held open for writing and got an error, effectively the same as you saw, so I don't know how it works for you. Which logs are you talking about?

      – AFH
      Oct 22 '14 at 17:00



















    • The process cannot access the file because it is being used by another process.

      – gstackoverflow
      Oct 22 '14 at 12:19






    • 1





      How you clearing it manually?

      – aphoria
      Oct 22 '14 at 12:22











    • I open this file using notepade++ and clear content and save file

      – gstackoverflow
      Oct 22 '14 at 12:59








    • 1





      If another process has the file locked, I'm not sure how you can be clearing and saving it.

      – aphoria
      Oct 22 '14 at 16:56






    • 1





      I have tried a lot of methods on this and they all involve doing quite a lot of work (installing software or programming). Your simplest answer is to boot into safe mode (command-line only) and the above solutions should work. This will be fine for a one-off, though not something to do regularly. I tried NP++ on a file held open for writing and got an error, effectively the same as you saw, so I don't know how it works for you. Which logs are you talking about?

      – AFH
      Oct 22 '14 at 17:00

















    The process cannot access the file because it is being used by another process.

    – gstackoverflow
    Oct 22 '14 at 12:19





    The process cannot access the file because it is being used by another process.

    – gstackoverflow
    Oct 22 '14 at 12:19




    1




    1





    How you clearing it manually?

    – aphoria
    Oct 22 '14 at 12:22





    How you clearing it manually?

    – aphoria
    Oct 22 '14 at 12:22













    I open this file using notepade++ and clear content and save file

    – gstackoverflow
    Oct 22 '14 at 12:59







    I open this file using notepade++ and clear content and save file

    – gstackoverflow
    Oct 22 '14 at 12:59






    1




    1





    If another process has the file locked, I'm not sure how you can be clearing and saving it.

    – aphoria
    Oct 22 '14 at 16:56





    If another process has the file locked, I'm not sure how you can be clearing and saving it.

    – aphoria
    Oct 22 '14 at 16:56




    1




    1





    I have tried a lot of methods on this and they all involve doing quite a lot of work (installing software or programming). Your simplest answer is to boot into safe mode (command-line only) and the above solutions should work. This will be fine for a one-off, though not something to do regularly. I tried NP++ on a file held open for writing and got an error, effectively the same as you saw, so I don't know how it works for you. Which logs are you talking about?

    – AFH
    Oct 22 '14 at 17:00





    I have tried a lot of methods on this and they all involve doing quite a lot of work (installing software or programming). Your simplest answer is to boot into safe mode (command-line only) and the above solutions should work. This will be fine for a one-off, though not something to do regularly. I tried NP++ on a file held open for writing and got an error, effectively the same as you saw, so I don't know how it works for you. Which logs are you talking about?

    – AFH
    Oct 22 '14 at 17:00













    0














    Just a thought if the file is being used and you can't clear it, and notepad ++ is allowing you to clear it why not just use a script in notepad++ like @Dhiwakar Ravikumar mentioned? If Scripts are out of the question, and assuming you have quite a bit of log files, why not just open them all in notepad++, Select the first open tab and hit Ctrl + A, then Delete key, Then Ctrl + S, then Ctrl + W? That would select all the text in the file, Delete it, Save the file, Then close it and then just do the same thing. (Like a Script)






    share|improve this answer




























      0














      Just a thought if the file is being used and you can't clear it, and notepad ++ is allowing you to clear it why not just use a script in notepad++ like @Dhiwakar Ravikumar mentioned? If Scripts are out of the question, and assuming you have quite a bit of log files, why not just open them all in notepad++, Select the first open tab and hit Ctrl + A, then Delete key, Then Ctrl + S, then Ctrl + W? That would select all the text in the file, Delete it, Save the file, Then close it and then just do the same thing. (Like a Script)






      share|improve this answer


























        0












        0








        0







        Just a thought if the file is being used and you can't clear it, and notepad ++ is allowing you to clear it why not just use a script in notepad++ like @Dhiwakar Ravikumar mentioned? If Scripts are out of the question, and assuming you have quite a bit of log files, why not just open them all in notepad++, Select the first open tab and hit Ctrl + A, then Delete key, Then Ctrl + S, then Ctrl + W? That would select all the text in the file, Delete it, Save the file, Then close it and then just do the same thing. (Like a Script)






        share|improve this answer













        Just a thought if the file is being used and you can't clear it, and notepad ++ is allowing you to clear it why not just use a script in notepad++ like @Dhiwakar Ravikumar mentioned? If Scripts are out of the question, and assuming you have quite a bit of log files, why not just open them all in notepad++, Select the first open tab and hit Ctrl + A, then Delete key, Then Ctrl + S, then Ctrl + W? That would select all the text in the file, Delete it, Save the file, Then close it and then just do the same thing. (Like a Script)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 23 '14 at 18:16









        trententrenten

        12519




        12519























            0














            Save the below code as a batch file and Run it.



            You can save the trouble of typing the command everytime :).



            Change M:Newfolder & *.txt to reflect your path & log file extension respectively.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            TYPE nul > %%G
            )
            pause


            UPDATE



            You can try to create a Macro to automate what you want to do.



            Check out the first answer provided by ellak here



            Open all your Log Files at once and then Run this Macro Everytime.



            If you want to automate even that (opening all your Log Files at once) then Run the Batch Script below.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            notepad++.exe %%G
            )
            pause


            So the next time you want to clear your Log Files, Simply
            1. Run the Batch Script provided
            2. Run the Macro from Notepad++



            There is a way to run them both from the same script but this requires NPPExec Plugins that I'm not too familiar with. Please let me know if you want it with the plugin or if the solution provided above will suffice.






            share|improve this answer


























            • The process cannot access the file because it is being used by another process

              – gstackoverflow
              Oct 22 '14 at 12:22











            • That means the file is being used. You can't clear the contents of a file that you have opened (in notepad or some other application)

              – Dhiwakar Ravikumar
              Oct 22 '14 at 12:23











            • At this moment I can open this file using notepade++ and clear content and save file

              – gstackoverflow
              Oct 22 '14 at 12:58








            • 1





              I thought the purpose of asking the question was to avoid doing it manually. Please try to find out the Application using these Logs. End it and run the script again.

              – Dhiwakar Ravikumar
              Oct 22 '14 at 13:36











            • Yes, I want to avoid make it manually. Application server keep these logs files. And I don't want to stop it. hotepade ++ allow this

              – gstackoverflow
              Oct 22 '14 at 13:45
















            0














            Save the below code as a batch file and Run it.



            You can save the trouble of typing the command everytime :).



            Change M:Newfolder & *.txt to reflect your path & log file extension respectively.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            TYPE nul > %%G
            )
            pause


            UPDATE



            You can try to create a Macro to automate what you want to do.



            Check out the first answer provided by ellak here



            Open all your Log Files at once and then Run this Macro Everytime.



            If you want to automate even that (opening all your Log Files at once) then Run the Batch Script below.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            notepad++.exe %%G
            )
            pause


            So the next time you want to clear your Log Files, Simply
            1. Run the Batch Script provided
            2. Run the Macro from Notepad++



            There is a way to run them both from the same script but this requires NPPExec Plugins that I'm not too familiar with. Please let me know if you want it with the plugin or if the solution provided above will suffice.






            share|improve this answer


























            • The process cannot access the file because it is being used by another process

              – gstackoverflow
              Oct 22 '14 at 12:22











            • That means the file is being used. You can't clear the contents of a file that you have opened (in notepad or some other application)

              – Dhiwakar Ravikumar
              Oct 22 '14 at 12:23











            • At this moment I can open this file using notepade++ and clear content and save file

              – gstackoverflow
              Oct 22 '14 at 12:58








            • 1





              I thought the purpose of asking the question was to avoid doing it manually. Please try to find out the Application using these Logs. End it and run the script again.

              – Dhiwakar Ravikumar
              Oct 22 '14 at 13:36











            • Yes, I want to avoid make it manually. Application server keep these logs files. And I don't want to stop it. hotepade ++ allow this

              – gstackoverflow
              Oct 22 '14 at 13:45














            0












            0








            0







            Save the below code as a batch file and Run it.



            You can save the trouble of typing the command everytime :).



            Change M:Newfolder & *.txt to reflect your path & log file extension respectively.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            TYPE nul > %%G
            )
            pause


            UPDATE



            You can try to create a Macro to automate what you want to do.



            Check out the first answer provided by ellak here



            Open all your Log Files at once and then Run this Macro Everytime.



            If you want to automate even that (opening all your Log Files at once) then Run the Batch Script below.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            notepad++.exe %%G
            )
            pause


            So the next time you want to clear your Log Files, Simply
            1. Run the Batch Script provided
            2. Run the Macro from Notepad++



            There is a way to run them both from the same script but this requires NPPExec Plugins that I'm not too familiar with. Please let me know if you want it with the plugin or if the solution provided above will suffice.






            share|improve this answer















            Save the below code as a batch file and Run it.



            You can save the trouble of typing the command everytime :).



            Change M:Newfolder & *.txt to reflect your path & log file extension respectively.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            TYPE nul > %%G
            )
            pause


            UPDATE



            You can try to create a Macro to automate what you want to do.



            Check out the first answer provided by ellak here



            Open all your Log Files at once and then Run this Macro Everytime.



            If you want to automate even that (opening all your Log Files at once) then Run the Batch Script below.



            @ECHO OFF 
            setlocal EnableDelayedExpansion
            FOR /R M:Newfolder %%G IN (*.txt) DO (
            notepad++.exe %%G
            )
            pause


            So the next time you want to clear your Log Files, Simply
            1. Run the Batch Script provided
            2. Run the Macro from Notepad++



            There is a way to run them both from the same script but this requires NPPExec Plugins that I'm not too familiar with. Please let me know if you want it with the plugin or if the solution provided above will suffice.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 23 '17 at 12:41









            Community

            1




            1










            answered Oct 22 '14 at 11:56









            Dhiwakar RavikumarDhiwakar Ravikumar

            97441432




            97441432













            • The process cannot access the file because it is being used by another process

              – gstackoverflow
              Oct 22 '14 at 12:22











            • That means the file is being used. You can't clear the contents of a file that you have opened (in notepad or some other application)

              – Dhiwakar Ravikumar
              Oct 22 '14 at 12:23











            • At this moment I can open this file using notepade++ and clear content and save file

              – gstackoverflow
              Oct 22 '14 at 12:58








            • 1





              I thought the purpose of asking the question was to avoid doing it manually. Please try to find out the Application using these Logs. End it and run the script again.

              – Dhiwakar Ravikumar
              Oct 22 '14 at 13:36











            • Yes, I want to avoid make it manually. Application server keep these logs files. And I don't want to stop it. hotepade ++ allow this

              – gstackoverflow
              Oct 22 '14 at 13:45



















            • The process cannot access the file because it is being used by another process

              – gstackoverflow
              Oct 22 '14 at 12:22











            • That means the file is being used. You can't clear the contents of a file that you have opened (in notepad or some other application)

              – Dhiwakar Ravikumar
              Oct 22 '14 at 12:23











            • At this moment I can open this file using notepade++ and clear content and save file

              – gstackoverflow
              Oct 22 '14 at 12:58








            • 1





              I thought the purpose of asking the question was to avoid doing it manually. Please try to find out the Application using these Logs. End it and run the script again.

              – Dhiwakar Ravikumar
              Oct 22 '14 at 13:36











            • Yes, I want to avoid make it manually. Application server keep these logs files. And I don't want to stop it. hotepade ++ allow this

              – gstackoverflow
              Oct 22 '14 at 13:45

















            The process cannot access the file because it is being used by another process

            – gstackoverflow
            Oct 22 '14 at 12:22





            The process cannot access the file because it is being used by another process

            – gstackoverflow
            Oct 22 '14 at 12:22













            That means the file is being used. You can't clear the contents of a file that you have opened (in notepad or some other application)

            – Dhiwakar Ravikumar
            Oct 22 '14 at 12:23





            That means the file is being used. You can't clear the contents of a file that you have opened (in notepad or some other application)

            – Dhiwakar Ravikumar
            Oct 22 '14 at 12:23













            At this moment I can open this file using notepade++ and clear content and save file

            – gstackoverflow
            Oct 22 '14 at 12:58







            At this moment I can open this file using notepade++ and clear content and save file

            – gstackoverflow
            Oct 22 '14 at 12:58






            1




            1





            I thought the purpose of asking the question was to avoid doing it manually. Please try to find out the Application using these Logs. End it and run the script again.

            – Dhiwakar Ravikumar
            Oct 22 '14 at 13:36





            I thought the purpose of asking the question was to avoid doing it manually. Please try to find out the Application using these Logs. End it and run the script again.

            – Dhiwakar Ravikumar
            Oct 22 '14 at 13:36













            Yes, I want to avoid make it manually. Application server keep these logs files. And I don't want to stop it. hotepade ++ allow this

            – gstackoverflow
            Oct 22 '14 at 13:45





            Yes, I want to avoid make it manually. Application server keep these logs files. And I don't want to stop it. hotepade ++ allow this

            – gstackoverflow
            Oct 22 '14 at 13:45


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f830000%2fhow-to-clear-content-of-a-lot-of-text-files-fast-under-windows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix