How do I force delete a directory which contains hidden files?

0 votes
asked Mar 11, 2013 by DS1 (160 points)
edited Mar 11, 2013

Hello, When I try to delete a directory which contains only one file eg. 'Thumbs.db'. then I get an exception like directory is non empty. When I call GetList() it does not return the system files so how can I solve this issue? Is there any way to force delete directory or can I get a list of hidden files?

thanks!

1 Answer

0 votes
answered Mar 11, 2013 by Tomas Knopp (58,890 points)
edited Mar 11, 2013

Hello, it happens quite often on unix FTP servers that hidden files are not listed. There is an option 'ForceListHiddenFiles' which forces such servers to list also hidden files. Please use it like this:

        Ftp ftp = new Ftp();
        ftp.Settings.ForceListHiddenFiles = true;

        // connect & login

        foreach (var item in ftp.GetList())
            Console.WriteLine(item.Name);

        ftp.Disconnect();

Does GetList() method return also 'Thumbs.db' now?

...