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

Re: Directory overwriting



Rodolfo Medina wrote:

>> When I copy a file into the present directory, with:
>>
>>  $ cp /path/to/file .
>>
>> , if the file already exists it is overwritten, i.e. the `old one'
>> is removed and the `new one' takes its place.
>> Instead, with directories it is not the same:
>> when I do:
>>
>>  $ cp -vr /path/to/dir .
>>
>> , if the directory already exists it is not removed, but the new one
>> just adds files to the old one.
>>
>> Would it be possible, and how?, to have with directory overwriting
>> the same behaviour we have with file overwriting?



Mike McCarty writes:

> I think what you want is rsync. The techniques you saw posted
> earlier are somewhat more limited. Look into --delete.


Thanks, it seems to work.
To do what I want, I do:

 $ rsync -vr --delete /path/to/dir .

. Is that right?
Rodolfo



Reply to: