4 ms·
+ $ find /tmp/x ! -path /tmp/x -prune -type f -exec sh -c 'for p; do printf '\''%s\n'\'' "${p##*/}"; done' - {} + c b a Seems to do the trick and
by gray_-_wolf 6y ago
+ $ find /tmp/x ! -path /tmp/x -prune -type f -exec sh -c 'for p; do printf '\''%s\n'\'' "${p##*/}"; done' - {} +
c
b
a
Seems to do the trick and is POSIX only (so works on busybox and mac). You can probably just tack `| sort` at the end if you want it sorted.
- nindalf 6y agoThis answer reminds me of the classic HN comment - why use Dropbox when "you can already build such a system yourself quite trivially by getting an FTP account, mounting it locally with curlftpfs, and then using SVN or CVS on the mounted filesystem. From Windows or Mac, this FTP account could be accessed through built-in software." People value software that's easy to use. That command you typed is a Frankenstein's monster. https://news.ycombinator.com/item?id=9224 https://news.ycombinator.com/item?id=9224
- tingletech 6y agoThis had become a discussion of the best way to write the "shell macro" version that could replace the node.js program fls () { find . -maxdepth 1 -type f } vs fls () { find . ! -path . -prune \ -type f \ -exec sh -c 'for p; do printf '\''%s\n'\'' "${p##*/}"; done' - {} + } The user would just type `fls` in the directory they were exploring.