PuTTY pscp目录列表 – 你可以指定不同的文件date/时间格式?

我使用PuTTY中的pscp.exe和-ls选项通过STDOUT获取目录列表到perl脚本。

我得到的输出是这样的:

Listing directory /path/to/my/directory drwxr-sr-x 2 234 11 4096 Feb 4 11:11 . drwxrwxrwx 21 root root 4096 Jan 28 17:50 .. -rw-r--r-- 1 root 11 415570 Jan 10 12:27 009800D2-10003ACC.log -rw-r--r-- 1 root 11 131072 Dec 15 09:59 MCP.20101215_095929_644.snapshot.log -rw-r--r-- 1 root 11 131072 Jan 19 13:32 MCP.20110119_133211_032.snapshot.log -rw-r--r-- 1 root 11 10240105 Feb 2 22:32 MCP.20110202_173304_750.log -rw-r--r-- 1 root 11 10240077 Feb 3 04:07 MCP.20110202_223257_159.log -rw-r--r-- 1 root 11 10240094 Feb 3 06:29 MCP.20110203_040754_861.log -rw-r--r-- 1 root 11 10240095 Feb 3 07:43 MCP.20110203_062936_730.log -rw-r--r-- 1 root 11 10240066 Feb 3 10:20 MCP.20110203_074353_058.log 

然而,date/时间的格式是一个痛苦的工作。 理想情况下,我希望它是2011-02-04 10:02:33而不是`2月4日10:02'。 主要的问题是没有一年或几秒钟。

有没有办法指定date/时间格式?

为什么不使用plink.exe而是远程执行“ls”命令?

有很多ls命令行开关可以根据需要格式化输出。 而且,你可以远程pipe理其输出到awk,sed等

plink.exe user@remotehost "ls -l --full-time /my/remote/directory

我不能评论,plink的使用是要走的路,我只是build议使用--time-style="+%Y-%m-%d %H:%M:%S"而不是--full-time ,它让你摆脱秒后显示的不需要的东西