Re: Why mv have no '-R'
Listen Up wrote:
> Thanks to everybody.
>
> So I can take it this way,
> 'mv' does not really move data(in one file system), it just renames
> something--it can be a file or a directory.
> While 'cp' copies data, so I have to 'cp' all the files recurisively,
> in order to copy a directory into another one!
>
> But another problem: if file2 already exists, in the following
> $mv file1 file2
> file1 will be renamed as file2, but file2 still exists 'cause 'mv' did
> not move data and file2 won't be overwritten, right?
If the directory entry 'file2' is the only "pointer" to the file (i.e.
no additional "hard links" set and no process accessing the file) then
the file file2 *will* be removed. So, in most cases, you will overwrite
the file by using mv. Use mv -i to get asked whether the file should be
overwritten.
Janis
|