Linux控制台脚本根据前缀获取文件大小和修改日期?

时间:2021-05-18 01:06:55

i need to write a consol script that recieves two parametrs - a location and a string prefix, and outputs the modified time and size of every file in the location that starts with the given prefix.

我需要编写一个收到两个参数的consol脚本 - 一个位置和一个字符串前缀,并输出以给定前缀开头的位置中每个文件的修改时间和大小。

for example

例如

myscript.sh /localdisk st

will out put something like

会出类似的东西

start.txt 11111 Dec 2 14:41
stop.jar 1432 Dec 1 11:21
stud.gz 1122 Nov 2 10:12

any ideas? Thanks!

有任何想法吗?谢谢!

1 个解决方案

#1


1  

something like this:

像这样的东西:

find $1/$2* -printf "%f %s %TY-%Tm-%Td %TH:%TM\n"

#1


1  

something like this:

像这样的东西:

find $1/$2* -printf "%f %s %TY-%Tm-%Td %TH:%TM\n"