简体   繁体   中英

Sorting files based on time in Linux

I want to get a list of pathnames of files, divided by one blank space, and the files are sorted based on creation time. I use

find $dir -type f -printf '%T+\t%p\n' | sort -n 

to sort them, but the problem is, how can to delete all the time before the pathnames?

If I use

find $dir -printf '%p'

I can get a list of pathnames, but I don't know how to sort them.

你可以用

find $dir -type f -printf '%T+\t%p\n' | sort -n | cut -f2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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