On 09/11/2013 06:22 PM, Istvan Gabor wrote:
2013. szeptember 10. 3:23 napon Bernhard Voelker
írta: Unfortunately, you didn't write how the files are copied. So my guesses out of the blue:
I don't understand what you mean "how files are copied".
I meant how the result actually looks like. You provided an example below ...
I wrote I use cp -a --parents --target-directory=/media/disk
Maybe you add the -v option to see in which order cp(1) copies the files.
The output is something like this:
. ./01 ./01/01.mp3 ./01/02.mp3 ./01/03.mp3 ./01/04.mp3 ./01/05.mp3 ./01/06.mp3 ./01/07.mp3 ./01/08.mp3 ./01/09.mp3 ./01/10.mp3 ./01/11.mp3 ./01/12.mp3 ./02 ./02/01.mp3 ./02/02.mp3 ./02/03.mp3 ./02/04.mp3 ./02/05.mp3 ./02/06.mp3 ./02/07.mp3 ./02/08.mp3 ./02/09.mp3 ./02/10.mp3
Ah! Here is the problem .... and I described it in the next sentence:
Finally, find(1) will probably include and print the directories first ... which will make the sorting order for cp(1) useless because it will first copy the whole directory and then recognize that it has to copy the files in it (which has already been done). Did you mean this?
I think you are not right.
The above means that cp(1) first copies "." - which means the whole directory hierarchy -, and then continues with "./01" ... which is also a directory which has already been copied. Or in other words: all arguments after "." are redundant and therefore do in no way influence the order of copying. Therefore, cp(1) processes the "." directory as it always does: it just reads the directory entries, and this is usually done on the order of their creation. Notice the order of creation of the directories and files: $ mkdir 01 03 02 $ touch 01/01.mp3 02/02.mp3 03/03.mp3 To see what would be executed, I put a simple echo before cp(1): $ find . -print0 | sort -z | xargs -0 echo cp -a --parents --target-directory=/tmp/target -v cp -a --parents --target-directory=/tmp/target -v . ./01 ./01/01.mp3 ./02 ./02/02.mp3 ./03 ./03/03.mp3 And when executing that command, you see that first "." is processed - in the order of the above creation: `./01' -> `/tmp/target/./01' `./01/01.mp3' -> `/tmp/target/./01/01.mp3' `./03' -> `/tmp/target/./03' `./03/03.mp3' -> `/tmp/target/./03/03.mp3' `./02' -> `/tmp/target/./02' `./02/02.mp3' -> `/tmp/target/./02/02.mp3' .... and then the rest is copied (again!) which even given you some warnings for the directories: cp: will not create hard link `/tmp/target/./01' to directory `/tmp/target/./01' `./01/01.mp3' -> `/tmp/target/./01/01.mp3' cp: will not create hard link `/tmp/target/./02' to directory `/tmp/target/./02' `./02/02.mp3' -> `/tmp/target/./02/02.mp3' cp: will not create hard link `/tmp/target/./03' to directory `/tmp/target/./03' `./03/03.mp3' -> `/tmp/target/./03/03.mp3'
What is important, this command always worked in my previous systems. In openSUSE 12.2 it does not work. (I haven tested it in 12.1).
The only reason you were satisfied with the results at that time could be that the files have already been created in the order you wanted ... incidentally. Hope this helps. Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org