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

Re: General method for copying a partition



On Wed, 17 Feb 2010 12:26:43 -0500 (EST), Boyd Stephen Smith Jr. wrote:
> On Wednesday 17 February 2010 11:18:38 Stephen Powell wrote:
>> Then the files
>> are copied between partitions by means of
>> 
>>    cp -a /media/* /mnt
>> 
>> This seems to work OK except if there are "dot files" (files with names
>> beginning with a period) in the top directory of the source partition.
> 
> Use this instead:
> cp -a /media/. /mnt
> OR
> cp -a /media/{.[!.],}* /mnt

Your second method doesn't work in ash because ash does not support
brace expansion.  If I issue

   echo /media/{.[!.],}*

in ash, I get

   /media/{.[!.],}*

as output.  As for the first method, it seems to work.  Simple and elegant!
As an aside, I tried

   cp -a /media /mnt

and that didn't work properly.  I get an extra directory level (media)
thrown in.  I also tried

   cp -a /media/ /mnt

and that gave the same results as above.  But

   cp -a /media/. /mnt

works correctly.  Thank you!


Reply to: