Exemplo n.º 1
0
        /// <summary>
        /// Delete the directory with the given path.
        /// </summary>
        public static void Delete(string path, bool recursive)
        {
            var file = new JFile(path);

            if (file.IsDirectory())
            {
                if (recursive)
                {
                    var children = file.List();
                    foreach (var child in children)
                    {
                        var childFile = new JFile(child);
                        if (childFile.IsFile())
                        {
                            childFile.Delete();
                        }
                        if (childFile.IsDirectory())
                        {
                            Delete(child, recursive);
                        }
                    }
                }
                file.Delete();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Delete the directory with the given path.
        /// </summary>
        public static void Delete(string path)
        {
            var file = new JFile(path);

            if (file.IsDirectory())
            {
                file.Delete();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Delete the directory with the given path.
 /// </summary>
 public static void Delete(string path, bool recursive)
 {
     var file = new JFile(path);
     if (file.IsDirectory())
     {
         if (recursive)
         {
             var children = file.List();
             foreach (var child in children)
             {
                 var childFile = new JFile(child);
                 if (childFile.IsFile()) childFile.Delete();
                 if (childFile.IsDirectory()) Delete(child, recursive);
             }
         }
         file.Delete();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Delete the directory with the given path.
 /// </summary>
 public static void Delete(string path)
 {
     var file = new JFile(path);
     if (file.IsDirectory())
         file.Delete();
 }