Ejemplo n.º 1
0
 public static void Move(string source, string dest)
 {
     try
     {
         DirectoriesManager.Create(Path.GetDirectoryName(dest));
         File.Move(source, dest);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public static bool IsDirectoryWritable(string directoryPath, bool throwOnFail = false)
        {
            try
            {
                DirectoriesManager.Create(directoryPath);
                var path = Path.Combine(directoryPath, Path.GetRandomFileName());
                using (var fileStream = File.Create(path, 1, FileOptions.DeleteOnClose))
                {
                }

                return(true);
            }
            catch (UnauthorizedAccessException)
            {
                if (throwOnFail)
                {
                    throw;
                }
                return(false);
            }
        }
Ejemplo n.º 3
0
 public static void Copy(string sourcePath, string destinationPath, bool overwrite = true)
 {
     DirectoriesManager.Create(PathsManager.GetDirectoryPath(destinationPath));
     File.Copy(sourcePath, destinationPath, overwrite);
 }