bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21094: cp: add option to sort when copying


From: Pádraig Brady
Subject: bug#21094: cp: add option to sort when copying
Date: Mon, 20 Jul 2015 01:34:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 19/07/15 07:09, Steve Russell wrote:
> When performing a recursive copy of a large number of files it would be 
> helpful to have an option to copy the files in each directory in sorted order 
> of the file names. There are a couple of use cases for this.
>  
> The first is to be able to easily observe the progress of the copy using the 
> -v option. Currently, the "random" order of the copy means I can not tell how 
> far the copy has progressed. On occasions I have seen cp -v display a top 
> level directory starting with 'z' and assumed the copy was almost done only 
> to see it start copying files from another directory earlier in the alphabet.
>  
> The second use case is sometimes I would like to start working with the 
> destination files before the copy has completed. For example if I see the 
> destination has the top level directory "foo", an ordered copy means I can 
> work with directories that are alphabetically before "foo" knowing that they 
> will not change.
> 
> Another minor use case is some mp3 players ignore the file names and metadata 
> and always play tracks in the order they appear in the directory. Usually the 
> filesystems used by these players will order directories in the same order 
> files are added. For content like eBooks where track order is critical, a 
> sorted copy would be a useful workaround for the limitations of these players.

Thanks for the suggestion.

The implementation would be quite simple given that we already
sort directory entries by inode number to improve performance
(though note that that performance enhancement may not be
effective going forward with newer file systems and SSDs).

The implementation would leverage gnulib's SAVEDIR_SORT_NAME functionality.

The interface would probably mirror tar's --sort option.

I'm 55:45 for exposing this option to cp, install and maybe mv.

thanks,
Pádraig.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]