Skip to main content
deleted 728 characters in body
Source Link
Matthew
  • 351
  • 2
  • 14

Can I get the file modification time and size remotely without downloading the file?

I know that maybe I can use curl to get ithave a Linux VPS, but I don't know how to use shell script to get it in batches and writeThere are many HTML forms on it to the corresponding line of the file.

This is the source data text, which is an html file with the following contentsas 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>
        <tr>
            <td>1.0.6</td>
            <td><a href="http://speedtest.newark.linode.com/100MB-newark.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.7</td>
            <td><a href="http://speedtest.london.linode.com/100MB-london.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.8</td>
            <td><a href="http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.9</td>
            <td><a href="http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.10</td>
            <td><a href="http://speedtest.singapore.linode.com/100MB-singapore.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 modification timedate and size, and then write toupdate this information into the table, similar to the picture below.

enter image description here They will eventually look like this:

Anyenter 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 in advanceyou!

Can I get the file modification time and size remotely without downloading the file?

I know that maybe I can use curl to get it, but I don't know how to use shell script to get it in batches and write it to the corresponding line of the file.

This is the source data text, which is an html file with the following contents:

<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>
        <tr>
            <td>1.0.6</td>
            <td><a href="http://speedtest.newark.linode.com/100MB-newark.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.7</td>
            <td><a href="http://speedtest.london.linode.com/100MB-london.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.8</td>
            <td><a href="http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.9</td>
            <td><a href="http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.10</td>
            <td><a href="http://speedtest.singapore.linode.com/100MB-singapore.bin">download</a></td>
        </tr>
    </tbody>
</table>

I want to use a shell script to get the remote file modification time and size, and then write to the table, similar to the picture below.

enter image description here

Any help, thank in advance!

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!

added 251 characters in body
Source Link
Matthew
  • 351
  • 2
  • 14
<table>
    <thead>
        <tr>
            <th>ver</th>
            <th>link</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1.0.1</td>
            <td><a href="http://examplespeedtest.com/1tokyo2.0linode.1com/100MB-tokyo2.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.2</td>
            <td><a href="http://examplespeedtest.com/1singapore.0linode.2com/100MB-singapore.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.3</td>
            <td><a href="http://examplespeedtest.com/1fremont.0linode.3com/100MB-fremont.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.4</td>
            <td><a href="http://examplespeedtest.com/1dallas.0linode.4com/100MB-dallas.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.5</td>
            <td><a href="http://examplespeedtest.com/1atlanta.0linode.5com/100MB-atlanta.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.6</td>
            <td><a href="http://examplespeedtest.com/1newark.0linode.6com/100MB-newark.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.7</td>
            <td><a href="http://examplespeedtest.com/1london.0linode.7com/100MB-london.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.8</td>
            <td><a href="http://examplespeedtest.com/1frankfurt.0linode.8com/100MB-frankfurt.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.9</td>
            <td><a href="http://examplespeedtest.com/1tokyo2.0linode.9com/100MB-tokyo2.tgz">download<bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.10</td>
            <td><a href="http://examplespeedtest.com/1singapore.0linode.10com/100MB-singapore.tgz">download<bin">download</a></td>
        </tr>
    </tbody>
</table>
<table>
    <thead>
        <tr>
            <th>ver</th>
            <th>link</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1.0.1</td>
            <td><a href="http://example.com/1.0.1.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.2</td>
            <td><a href="http://example.com/1.0.2.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.3</td>
            <td><a href="http://example.com/1.0.3.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.4</td>
            <td><a href="http://example.com/1.0.4.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.5</td>
            <td><a href="http://example.com/1.0.5.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.6</td>
            <td><a href="http://example.com/1.0.6.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.7</td>
            <td><a href="http://example.com/1.0.7.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.8</td>
            <td><a href="http://example.com/1.0.8.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.9</td>
            <td><a href="http://example.com/1.0.9.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.10</td>
            <td><a href="http://example.com/1.0.10.tgz">download</a></td>
        </tr>
    </tbody>
</table>
<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>
        <tr>
            <td>1.0.6</td>
            <td><a href="http://speedtest.newark.linode.com/100MB-newark.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.7</td>
            <td><a href="http://speedtest.london.linode.com/100MB-london.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.8</td>
            <td><a href="http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.9</td>
            <td><a href="http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin">download</a></td>
        </tr>
        <tr>
            <td>1.0.10</td>
            <td><a href="http://speedtest.singapore.linode.com/100MB-singapore.bin">download</a></td>
        </tr>
    </tbody>
</table>
Source Link
Matthew
  • 351
  • 2
  • 14

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

Can I get the file modification time and size remotely without downloading the file?

I know that maybe I can use curl to get it, but I don't know how to use shell script to get it in batches and write it to the corresponding line of the file.

This is the source data text, which is an html file with the following contents:

<table>
    <thead>
        <tr>
            <th>ver</th>
            <th>link</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1.0.1</td>
            <td><a href="http://example.com/1.0.1.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.2</td>
            <td><a href="http://example.com/1.0.2.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.3</td>
            <td><a href="http://example.com/1.0.3.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.4</td>
            <td><a href="http://example.com/1.0.4.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.5</td>
            <td><a href="http://example.com/1.0.5.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.6</td>
            <td><a href="http://example.com/1.0.6.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.7</td>
            <td><a href="http://example.com/1.0.7.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.8</td>
            <td><a href="http://example.com/1.0.8.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.9</td>
            <td><a href="http://example.com/1.0.9.tgz">download</a></td>
        </tr>
        <tr>
            <td>1.0.10</td>
            <td><a href="http://example.com/1.0.10.tgz">download</a></td>
        </tr>
    </tbody>
</table>

I want to use a shell script to get the remote file modification time and size, and then write to the table, similar to the picture below.

enter image description here

Any help, thank in advance!