いいえ、datetimeに基づいてファイルをソートする他のオプションはありません。あなたはHadoopのバージョン< 2.7を使用している場合がやっているよう
、あなたはソート-k6,7使用する必要があります:
hdfs dfs -ls /tmp | sort -k6,7
とのHadoop 2.7.35 ls commandのために、以下のオプションが利用可能である:
Usage: hadoop fs -ls [-d] [-h] [-R] [-t] [-S] [-r] [-u] <args>
Options:
-d: Directories are listed as plain files.
-h: Format file sizes in a human-readable fashion (eg 64.0m instead of 67108864).
-R: Recursively list subdirectories encountered.
-t: Sort output by modification time (most recent first).
-S: Sort output by file size.
-r: Reverse the sort order.
-u: Use access time rather than modification time for display and sorting.
だから、簡単にファイルを並べ替えることができますトリックを行いません-t
hdfs dfs -ls -t -R (-r) /tmp
-ls? docの – Whitefret
:http://hadoop.apache.org/docs/r2.7.0/hadoop-project-dist/hadoop-common/FileSystemShell.html#ls。 'ls -R -t(-r)'は、最後の変更時までに再帰的検索順序で見つかったすべてのファイルのリストを提供します。 -rは逆順になります。 – Whitefret
はhadoop 2.6でそれを試しましたが、成功しませんでした。 – Whitefret