| View previous topic :: View next topic |
| Author |
Message |
MartyBartfast LXF regular

Joined: Mon Aug 22, 2005 8:25 am Posts: 780 Location: Hants, UK
|
Posted: Sat Aug 04, 2012 4:44 pm Post subject: How can I tell if a file has finished copying? |
|
|
Hi folks,
Ive got a file being copied onto a server (via ftp or scp), when it arrives I need to copy it onto somewhere else.
is there a neat/simple way for me to know for sure that the file has arrived in it's entirity before I try and copy it on?
I could do md5sum $file; sleep 2s ; md5sum $file and compare the two sums to know that it's not still being written but that seems a bit messy to me.
Any other thoughts? _________________ I have been touched by his noodly appendage. |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 7996 Location: Warrington, UK
|
Posted: Sat Aug 04, 2012 7:05 pm Post subject: |
|
|
lsof will tell you if the copy process still has a lock on the file. Or you could use the wait command to check when the process has completed. _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|