variierende datei



  • tach zusammen

    wie kann ich einer konsolenanwendung zum Löschen eine datei angeben in der z.B. die ersten vier buchstaben und die endung fix sind aber der rest dazwischen aber nicht?????

    der code den ich bis jetzt habe lautet:

    class Test
    {
    public static void Main()
    {
    string path = @"c:\test.txt";
    string path2 = path + "temp";
    try
    {
    using (StreamWriter sw = File.CreateText(path)) { }

    // Only do the Copy operation if the first file exists
    // and the second file does not.
    if (File.Exists(path))
    {
    // Try to delete the file.
    File.Delete(path);
    Console.WriteLine("The target is deleted.");
    Console.ReadLine();
    }
    else
    {
    Console.WriteLine("The source file does not exist.");
    Console.ReadLine();
    }
    }
    catch
    {
    Console.WriteLine("Double copying is not allowed, as expected.");
    }
    }
    }

    😕 michi



  • ist das nich das nicht das selbe wie im anderen thread 😕


Anmelden zum Antworten