If you tar a directory recursively, it just uses the order from the os's readdir.
But in some cases it's nice to tar the files sorted.
What's a good way to tar a directory sorted alphabetically?
请注意,就本问题而言,典型 Linux 系统上的 gnu-tar 没问题。
mik*_*erv 20
对于 GNU tar:
--sort=ORDER
Specify the directory sorting order when reading directories.
ORDER may be one of the following:
`none'
No directory sorting is performed. This is the default.
`name'
Sort the directory entries on name. The operating system may
deliver directory entries in a more or less random order, and
sorting them makes archive creation reproducible.
`inode'
Sort the directory entries on inode number. Sorting
directories on inode number may reduce the amount of disk
seek operations when creating an archive for some file
systems.
Run Code Online (Sandbox Code Playgroud)
您可能还想查看--preserve-order.
| 归档时间: |
|
| 查看次数: |
9581 次 |
| 最近记录: |