Skip to main content
3 of 3
deleted 728 characters in body
Matthew
  • 351
  • 2
  • 14

How to get remote file modification time and size from a shell script?

I have a Linux VPS, There are many HTML forms on it, as follows:

<table>
    <thead>
        <tr>
            <th>ver</th>
            <th>link</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1.0.1</td>
            <td><a href="http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.2</td>
            <td><a href="http://speedtest.singapore.linode.com/100MB-singapore.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.3</td>
            <td><a href="http://speedtest.fremont.linode.com/100MB-fremont.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.4</td>
            <td><a href="http://speedtest.dallas.linode.com/100MB-dallas.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.5</td>
            <td><a href="http://speedtest.atlanta.linode.com/100MB-atlanta.bin">download</a></td>
        </tr>
    </tbody>
</table>

The table is relatively simple, only the version number and file download link.

I want to use a shell script to access the URL in the table, in order to get the remote file date and size, then update this information into the table.

They will eventually look like this:

enter image description here

Before asking the question, I looked at the curl and wget documentation, where the curl test can view the file information in standard output, but I don't know how to write an automated script to accomplish this task. I just got in touch with Linux, hope can get everyone's help, thank you!

Matthew
  • 351
  • 2
  • 14