Reply: Transfer Resume/Transfer to Temporary Filename
In reply to...
So? Don't do that. Do this...
...yes, that's true, if you upload to a temp file, delete orig & move/rename temp file to orig file name, you WILL lose some file info/attribs.Reasons not to do that:
- As the file is uploaded to a temporary name, it is technically a new file, even though the file with target name already exists. So after the original file is deleted and temporary file is renamed to the original file name, you loose all attributes of the original file (such as owner and group) except for permissions.
So? Don't do that. Do this...
- Upload file with a temp name (file.tmp.part)
- Also, to counter...
You may also need to disable the feature altogether, particularly if you do not have permissions required (e.g. permissions to create a new file in target directory). - Set file times on file.tmp.part to match those on source
- Copy (not move or delete) file.tmp.part to file.orig (cp file.tmp.part file.orig) (this should preserve owner/group/perms, but not timestamps {which need updated anyway})
- I don't recommend cp -p (in this case), cuz I think that copies timestamps AND permissions, which we don't want.
- Copy timestamps: touch -r file.tmp.part file.orig
- Delete file.tmp.part (never delete file.orig, never lose owner/group)
- Upload file with a temp name (file.tmp.part)
- Copy (not move or delete) file.tmp.part to file.orig (cp file.tmp.part file.orig) (this should preserve owner/group/perms, but not timestamps {which need updated anyway})
- Set file times on file.orig to match those on source (never setting correct times on file.tmp.part)
- Delete file.tmp.part (never delete file.orig, never lose owner/group)