Kak*_*enx 39 ssh file-management
我正在使用文件管理器将服务器上的文件从一个目录移动到另一个目录.有没有办法保存文件创建日期/时间(首次添加到服务器时)?有人建议SSH,但我不是很熟悉它.有没有人对此有一些好的指示?
Tha*_*ela 69
scp与-p选项一起使用.
-p Preserves modification times, access times, and modes from the original file.
Run Code Online (Sandbox Code Playgroud)
将文件从本地复制到远程服务器的示例命令:
scp -p /home/mylocaldata/test.txt remote.example.com:/home/remote_dir
Run Code Online (Sandbox Code Playgroud)
请注意,这不会仅保留用户和组权限标志(rwx等).
小智 10
-t您还可以使用或--times选项通过 SSH 进行 rsync
rsync -P -e ssh -t <source> <destination>\nRun Code Online (Sandbox Code Playgroud)\n我喜欢使用该-P选项(与 相同--partial --progress),因为如果您中途停止传输(或失败),它不会删除所有文件,并且会报告进度。看man rsync
-t, --times\n This tells rsync to transfer modification times along with the\n files and update them on the remote system. Note that if this op\xe2\x80\x90\n tion is not used, the optimization that excludes files that have\n not been modified cannot be effective; in other words, a missing\n -t or -a will cause the next transfer to behave as if it used -I,\n causing all files to be updated (though rsync\xe2\x80\x99s delta-transfer al\xe2\x80\x90\n gorithm will make the update fairly efficient if the files haven\xe2\x80\x99t\n actually changed, you\xe2\x80\x99re much better off using -t).\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
34494 次 |
| 最近记录: |