public override void CopyFile(string sourceFilePath, IFileSystem targetFileSystem, string targetFilePath, bool overwrite)
 {
     if (targetFileSystem.IsLocal)
     {
         LongPathFile.Copy(sourceFilePath, targetFilePath, overwrite);
     }
     else
     {
         File.Copy(GetFullPath(sourceFilePath), targetFileSystem.GetFullPath(targetFilePath), overwrite);
     }
 }
Beispiel #2
0
 public static void Copy(string source, string dest, bool overwrite)
 {
     if (source.Length < MAX_PATH && dest.Length < MAX_PATH)
     {
         System.IO.File.Copy(source, dest, overwrite);
     }
     else
     {
         LongPathFile.Copy(source, dest, overwrite);
     }
 }
Beispiel #3
0
        public virtual void CopyTo(IFileSystemItem item)
        {
            string destinationPath;

            if (item is IDirectory)
            {
                ((IDirectory)item).MustExist();
                destinationPath = item.Path.Combine(Name).FullPath;
            }
            else
            {
                item.Parent.MustExist();
                destinationPath = (item).Path.FullPath;
            }

            LongPathFile.Copy(filePath, destinationPath, true);
        }
Beispiel #4
0
        public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target)
        {
            var driveFolders = source.GetDirectories().ToList();

            driveFolders = driveFolders.Where(d => !d.FullName.Contains("System Volume Information")).ToList();
            foreach (var dir in driveFolders)
            {
                CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name));
            }
            foreach (var file in source.GetFiles())
            {
                try
                {
                    LongPathFile.Copy(file.FullName, Path.Combine(target.FullName, file.Name), true);
                    //file.CopyTo(Path.Combine(target.FullName, file.Name), true);
                }
                catch
                {
                    MessageBox.Show(target.FullName + "       " + file.Name);
                }
            }
        }
Beispiel #5
0
 public LongPathFileInfo CopyTo(string destFileName, bool overwrite)
 {
     LongPathFile.Copy(this.NormalizedPath, destFileName, overwrite);
     return(new LongPathFileInfo(destFileName));
 }
Beispiel #6
0
        public override void CopyTo(FileSystemItem item)
        {
            var destinationPath = PrepareCopyTo(item);

            LongPathFile.Copy(Path, destinationPath, true);
        }