delete files by passing dos command in c# without promting the delete file message

csharp Hong Kong SAR
  • 13 years ago

     Hi

       I want to delete some set of files in foreach loop in c#..

       I use the dos command del to delete the files ..But The window prompting the message that "*Are u sure to delete Y/N?" Like this but i want to delete the set of files with out prompting delete mesage..Help me to solve this probs..I used /F but nothing works...

      Thanks in advance
     

  • 13 years ago

    Hi there,

    Why you don't use File class in .net.

    using System;
    using System.IO;

    // Delete File
    File.DeleteFile("C:\\Test.txt");

    // Delete Directory
    Directory.DeleteDirectory("C:\\Test") ;


     

  • 13 years ago

     Thanks I used that........

  • 13 years ago

     Thanks i used that....

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“You can stand on the shoulders of giants OR a big enough pile of dwarfs, works either way.”