Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

find some files under specific directory and sort the result according to the file's generated time.

6 views
Skip to first unread message

Hongyi Zhao

unread,
May 26, 2012, 3:51:40 AM5/26/12
to
Hi all,

I want to find the all of the file with the name DownPDG.log under
specific directory / sub-directories, then sort the result according to
the file's generated time. The issue is these files may locate under
some sub-directories which including white spaces in the path. In this
case, I will meet the error like the following:

-----------
werner@debian:~$ find "/home/werner/Documents/超星电子书" -name DownPDG.log
| xargs ls -lta
ls: cannot access /home/werner/Documents/超星电子书/群论: No such file or
directory
ls: cannot access (下册)_80406437/DownPDG.log: No such file or directory
ls: cannot access /home/werner/Documents/超星电子书/高等学校教学用书: No such
file or directory
ls: cannot access 连续媒质电动力学: No such file or directory
ls: cannot access (下册)_80408349/DownPDG.log: No such file or directory
ls: cannot access /home/werner/Documents/超星电子书/北京市自然科学基金资助: No
such file or directory
ls: cannot access 约束哈密顿系统及其对称性质_10201470/DownPDG.log: No such
file or directory
-rw-r--r-- 1 werner werner 2413 May 26 15:25 /home/werner/Documents/超星电子
书/本草对症养生食疗经:常见病食疗药膳调养手册_12457834/DownPDG.log
-rw-r--r-- 1 werner werner 1730 May 26 14:21 /home/werner/Documents/超星电子
书/二十四节气药膳大全集_12739170/DownPDG.log
-rw-r--r-- 1 werner werner 2623 May 5 12:38 /home/werner/Documents/超星电子
书/高等电磁学基础:电磁学,量子力学和狭义相对论的一些新的重要发现_12252322/DownPDG.log
-rw-r--r-- 1 werner werner 458 Mar 9 15:57 /home/werner/Documents/超星电子
书/中国武艺图籍考_11956484/DownPDG.log
-rw-r--r-- 1 werner werner 1767 Mar 9 15:57 /home/werner/Documents/超星电子
书/现代无穷小分析导引_12242302/DownPDG.log
-rw-r--r-- 1 werner werner 4751 Mar 3 14:44 /home/werner/Documents/超星电子
书/1897-1992商务印书馆九十五年:我和商务印书馆_10294075/DownPDG.log
-rw-r--r-- 1 werner werner 1641 Feb 17 21:58 /home/werner/Documents/超星电子
书/对称_12145726/DownPDG.log
-rw-r--r-- 1 werner werner 1499 Feb 12 17:47 /home/werner/Documents/超星电子
书/集合论与连续统假设浅说_11179602/DownPDG.log
-rw-r--r-- 1 werner werner 456 Dec 8 13:28 /home/werner/Documents/超星电子
书/易经新探——易之数理及医易同源的启示_10849870/DownPDG.log
werner@debian:~$
-----------

Could someone please give me some hints on my issue?

Regards
--
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.

Luuk

unread,
May 26, 2012, 4:37:41 AM5/26/12
to
On 26-05-2012 09:51, Hongyi Zhao wrote:
> Hi all,
>
> I want to find the all of the file with the name DownPDG.log under
> specific directory / sub-directories, then sort the result according to
> the file's generated time. The issue is these files may locate under
> some sub-directories which including white spaces in the path. In this
> case, I will meet the error like the following:
>
> -----------
> werner@debian:~$ find "/home/werner/Documents/超星电子书" -name DownPDG.log
> | xargs ls -lta
> ls: cannot access /home/werner/Documents/超星电子书/群论: No such file or
> directory

find "/home/werner/Documents/超星电子书" -name DownPDG.log |
sed 's/ /\\ /g' |
xargs ls -lta



Hongyi Zhao

unread,
May 26, 2012, 9:51:49 AM5/26/12
to
On Sat, 26 May 2012 10:37:41 +0200, Luuk wrote:

> find "/home/werner/Documents/超星电子书" -name DownPDG.log |
> sed 's/ /\\ /g' |
> xargs ls -lta

Thanks a lot, I've got it.
0 new messages