/****************************************************************************/ private void CopyToFile(DiskFileSpec objDestination, bool bOverwrite) { if (this.DirectoryName != objDestination.DirectoryName) { if (this.SingleFile) { string strSource = this.DirectoryName + this.FileName; string strDestination = objDestination.FileName; if (strDestination == "*.*") { strDestination = this.FileName; } strDestination = objDestination.DirectoryName + strDestination; if (this.Progress != null) { this.Progress.SetProgress(strSource); } DiskFile.CopyFile(strSource, strDestination, bOverwrite); } else { IEnumerable aFiles = this.GetFiles(false); foreach (string strSourceFilePath in aFiles) { string strFileName = Path.GetFileName(strSourceFilePath); if (!Excluded(strFileName)) { if (this.Progress != null) { this.Progress.SetProgress(strSourceFilePath); } DiskFile.CopyFile(strSourceFilePath, objDestination.DirectoryName + strFileName, bOverwrite); } } if (this.CopySubFolders) { string[] aSubFolders = Directory.GetDirectories(this.DirectoryName); foreach (string strSubFolder in aSubFolders) { DiskFileSpec objFrom = new DiskFileSpec(strSubFolder); int iIndex = strSubFolder.LastIndexOf("\\"); DiskFileSpec objTo = null; objFrom.Progress = this.Progress; if (iIndex != -1) { objTo = new DiskFileSpec(objDestination.DirectoryName + strSubFolder.Remove(0, iIndex + 1)); } objFrom.CopySubFolders = true; objFrom.m_aExcludeExtensions = this.m_aExcludeExtensions; objFrom.CopyTo(objTo, bOverwrite); } } } } }