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
.



Relevant Pages

  • Re: *nix data wipe tools
    ... >file system to destroy the contents of a file. ... >that overwrite requests will actually overwrite the intended bits. ... encounter; flash memory devices, e.g., only pretend to be an array of bytes; ... Personally I prefer a "lose key, lose data" approach to secure erase; ...
    (Bugtraq)
  • Re: Help with (relatively) securely deleting files?
    ... Would that not overwrite the blocks ... :This depends on the file system. ... :areas, which aren't available for dd, except for the file tail. ... would not be touched by your 'dd' command. ...
    (comp.security.unix)
  • Re: How to get fullpathname form MFT
    ... so CreateFile() fails ... but I can overwrite a.exe file by write sector. ... and most likely damage the file system. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: LABELs
    ... system or not (ANY file system) when copying from device/partition to ... It will only overwrite the number of bytes that are copied. ...
    (Fedora)
  • Re: fi
    ... for (key in file1) ... if (!(key in file2)) ... else further occurances will overwrite each other. ... Anton Treuenfels ...
    (comp.lang.awk)