lundi 4 mars 2019

Using WinAPI method SHGetKnownFolderPath to delete specific files in Downloads folder

I've managed to implement the WinAPI method SHGetKnownFolderPath but when using the following -

string rootFolderPath = KnownFolders.GetPath(KnownFolder.Downloads);
        string filesToDelete = @"*Agreement, CCRPCI, SECCI, Debit*.pdf";
        string[] fileList = System.IO.Directory.GetFiles(rootFolderPath, filesToDelete);
        foreach(string file in fileList)
        {
            System.IO.File.Delete(file);
        }

I can't get it to delete those specific files? Do I need to change part of the System.IO.Directory.GetFiles if I'm using KnownFolders.GetPath?

Aucun commentaire:

Enregistrer un commentaire