/// <summary> /// creates the sub folder at the root level /// </summary> /// <param name="newName"></param> public void MoveAllSubElements(DirectoryInfo newPath) { // move all files foreach (FileInfo subFile in BaseDirectory.GetFiles("*", SearchOption.TopDirectoryOnly)) { subFile.MoveTo(System.IO.Path.Combine(newPath.FullName, subFile.Name)); } // move all folders foreach (DirectoryInfo subDir in BaseDirectory.GetDirectories("*", SearchOption.TopDirectoryOnly)) { subDir.MoveTo(System.IO.Path.Combine(newPath.FullName, subDir.Name)); } }
/// <summary> /// checks if the current folder has sub elements (noncached) /// </summary> /// <returns></returns> public bool HasElements() { return(BaseDirectory.GetDirectories("*", SearchOption.TopDirectoryOnly).Any() || BaseDirectory.GetFiles("*", SearchOption.TopDirectoryOnly).Any()); }