简体   繁体   English

如何从URL读取文件的创建日期信息

[英]How do I read the date created info of a file from URL

Is it possible for me to get the creation date of a file given a url without downloading the file? 是否可以通过给定URL获得文件的创建日期而无需下载文件?

lets say its http:///sever1.example.com/foo.bar . 可以说它的http:///sever1.example.com/foo.bar How do I get the date that foo bar was created on a bash terminal 如何获取在bash终端上创建foo bar的日期

There is no need to use curl , BASH can handle TCP connections: 无需使用curl ,BASH可以处理TCP连接:

$ exec 5<>/dev/tcp/google.com/80
$ echo -e "GET / HTTP/1.0\n" >&5
$ head -5 <&5
HTTP/1.0 200 OK
Date: Tue, 04 Dec 2018 13:29:30 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
$ exec 5>&-

Inline with @MichaWiedenmann I see the only solution is to use a 3rd party binary like curl to help bash in the command 与@MichaWiedenmann内联我看到唯一的解决方案是使用curl等第三方二进制文件来帮助命令中的bash

curl -Is http://server1.example.com/foo.bar

This would print information which can be manipulated with grep and sed to fit my purposes 这将打印可以用grep处理并根据我的目的sed的信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM