/// <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)); } }
private IEnumerable <System.Reflection.Assembly> GetAssembly() { var assemblies = new List <System.Reflection.Assembly>(); BaseDirectory.Create(); if (BaseDirectory.Exists()) { var files = BaseDirectory.GetFiles("*.dll"); foreach (var file in files) { assemblies.Add(CustomAssembly.LoadFile(file.FullName)); } return(assemblies); } else { throw new DirectoryException($"BaseDirectory from path \"{BaseDirectory}\" is not exist"); } }
/// <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()); }
public virtual FileInfo[] GetAllFiles(string pattern) { return(BaseDirectory.GetFiles(pattern, SearchOption)); }