Removing Folders with spaces

Would anyone have an idea on how to remove folders that contain spaces? I have tried the following with variations such as replacing spaces with %20 or wrapping the folder name in quotes but no luck.

thanks.

public static void DeleteRecursive(string cDir )
{
Java.IO.File fileOrDirectory = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDcim + cDir );
Java.IO.File[] files = fileOrDirectory.ListFiles() ;
if (fileOrDirectory.IsDirectory)
{
for (int i = 0; i < files.Count(); i++)
DeleteRecursive(files[i].Name);
}
fileOrDirectory.Delete();
}

and

public static bool RmDir(string path)
{
        Java.IO.File file = new Java.IO.File(path);
        if (file.Exists())
        {
            String deleteCmd = "rm -r " + path ;
            Java.Lang.Runtime runtime = Java.Lang.Runtime.GetRuntime();
            try
            {
                runtime.Exec(deleteCmd);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Return false;
            }
        }
        return true;

} 
Sign In or Register to comment.