avatar
compare which file is newer# Unix - 噫吁兮,危乎高哉
i*e
1
how to compare, with a command or script, which file is newer:
one is in the local machine, another is in a remote machine.
avatar
e*s
2
how do you define "newer"? based on created time?
modified time? file size? etc.

【在 i***e 的大作中提到】
: how to compare, with a command or script, which file is newer:
: one is in the local machine, another is in a remote machine.

avatar
i*e
3
last modified time.

【在 e***s 的大作中提到】
: how do you define "newer"? based on created time?
: modified time? file size? etc.

avatar
j*y
4
ls -t file1 file2
output:
the first file is newer
or ls -rt file1 file2
output:
the first file is older

【在 i***e 的大作中提到】
: how to compare, with a command or script, which file is newer:
: one is in the local machine, another is in a remote machine.

avatar
i*e
5
i mean file1 and file2 are in different machines.

【在 j***y 的大作中提到】
: ls -t file1 file2
: output:
: the first file is newer
: or ls -rt file1 file2
: output:
: the first file is older

avatar
b*l
6
ls -t -l file1; rsh ls -t -l file2

【在 i***e 的大作中提到】
: how to compare, with a command or script, which file is newer:
: one is in the local machine, another is in a remote machine.

avatar
i*e
7
well, what i want to do is this:
if ["file1 in local machine" newer than "file2 in remote machine"]; then
scp -p file1 [email protected]_machine:file2
else
scp -p [email protected]_machine:file2 file1
fi
so, how to implement the test of condition? thanks!

【在 b*********l 的大作中提到】
: ls -t -l file1; rsh ls -t -l file2
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。