Linux shell: 对特定时间的文件执行操作

有时候目录下文件数目比较多,手动逐个操作费时费力,因此可以通过查找文件的生成时间找到这些文件,随后执行删除、转移等操作。

例如需要找到09点92分的文件并转移到tmp文件夹:

for filename in `ls`;

do

if [ `date -r $filename +%H%M` == “0952” ];

then mv $filename ./tmp;

fi;

done

Advertisements
关于

Bioinformatics

发表在 Linux

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: