i***e 发帖数: 3219 | 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. |
e***s 发帖数: 1397 | 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.
|
i***e 发帖数: 3219 | 3 last modified time.
【在 e***s 的大作中提到】 : how do you define "newer"? based on created time? : modified time? file size? etc.
|
j***y 发帖数: 87 | 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.
|
i***e 发帖数: 3219 | 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
|
b*********l 发帖数: 30 | 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.
|
i***e 发帖数: 3219 | 7 well, what i want to do is this:
if ["file1 in local machine" newer than "file2 in remote machine"]; then
scp -p file1 me@remote_machine:file2
else
scp -p me@remote_machine:file2 file1
fi
so, how to implement the test of condition? thanks!
【在 b*********l 的大作中提到】 : ls -t -l file1; rsh ls -t -l file2
|