[Top][All Lists]

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

Patch for "mv -s" option

From: Brendan Byrd/SineSwiper
Subject: Patch for "mv -s" option
Date: Fri, 05 Nov 2004 06:52:57 -0500
User-agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)

I hashed out a patch for mv which is more or less the opposite of the "--symbolic-link" option for cp. Instead of creating symlinks on the destination before the copy, it creates symlinks on the source after the move.

Most of the code was copied from the cp.c and copy.c code. There is one minor warning in the new code (which I don't quite understand), but it otherwise runs fine. I've tested it here, though it might require some more through testing. For now, I've commented out the "goto un_backup" statements. Eventually, these will need to be fixed. (I would think the backup option is barely used, anyway.)

Also, I have a question about how files are moved. Currently, all files are copied to a new diskspace, and then the old diskspace is removed. Why not just create a hardlink (ie: x->hard_link = 1;) and remove that link? It's faster and does not fragment the hard drive. Directories structures may need to be copied, but the files themselves can easily have a hard link. After looking at the code, I was surprised that this wasn't in there. (Actually, I'm surprised nobody bothered with this feature, either. :P

Brendan Byrd/SineSwiper <address@hidden>
Computer techie, Perl hacker, and all-purpose Internet guru
Resonator Software (http://www.ResonatorSoft.org/)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]