Will the other process be able to finish reading the old file even though it's been replaced?
Asked
Active
Viewed 87 times
2 Answers
5
Yes, the process with the file open will be reading the file via an open file descriptor. The mv command just changes the associated directory entry.
user9517
- 114,104
- 20
- 206
- 289
2
If the other process keeps the file open the entire time, then yes it should be able to continue reading.
Just like you can delete an open file, and processes that file open will still be able to read/write from the file, until it closes.
Zoredache
- 128,755
- 40
- 271
- 413
-
And it's not filesystem dependent right? – user533020 Mar 09 '12 at 22:42
-
@user533020: It's certainly this way on all *NIX FS: ext, xfs, jfs, etc. FAT and NTFS (especially the userspace implementation) may behave differently. – Hubert Kario Mar 09 '12 at 23:56