Determine if the file can be moved or copied.

Besides trying to perform the operation and catching the exception, is there a way to determine if the file can be moved or copied?

+3
source share
3 answers

It is impossible to find out whether the file will be moved or copied will be guaranteed or not.

But you can check quite a few things to see if this works out:

  • Check the disk space at the destination (you need at least the size of your file)
  • Check the file that already exists at the destination
  • Opens a file, asking for read access in the source file, to make sure that 1) you have rights to it, 2) it is not used.
  • , , .
  • , Windows ( ), , , . , , .
  • , , , , , .
  • , , Volume Shadow Copy (VSS).

:

, Linux.

, , Windows.

+5

, , ( ) . , . , , .

, , . . .

0

, . , , ?

-1

Source: https://habr.com/ru/post/1705067/


All Articles