I am trying to copy/move a large file (15 GB) to a directory in Linux and want to have a dependency on that event.
Now lets say I have a file named abc.txt
, and I am running below command:
mv /usr/tmp/abc.txt /usr/data/
When the move process start I see a file in data directory with the actual file name i.e. abc.txt
but with data still being in transit. As the data directory list the file abc.txt
in its directory my dependent process thinks that the file is available and it start the dependent process however the file is not completely moved and hence my dependent process triggers prematurely.
Is there a way I can move a file with transient name i.e. while the data transfer is going on it will use a transient name(some swap file name) and change the name to actual file when it is completely transferred?