This way, my media files can be accessed by all local users -- it also makes backing up of personal files (as opposed media files) easier.
The problem is, when moving files in or out of those shared folders, Linux mv can not resolve the complicated symbolic path -- what it sees are files across file systems. Therefore, a simple mv is translated into cp and rm, rather than simply updating the node info.
The solution is to translate everything to absolute path. Here's a simple script to do that.
#!/usr/bin/perl
use Cwd 'abs_path';
foreach my $arg (@ARGV)
{
next if ($arg =~ /^-/); # skip switches
$arg = abs_path($arg);
$arg =~ s|^/home/|/mnt/raid/home/|;
}
system("/bin/mv", @ARGV);
This alone is enough for my environment. You may want to have more substitution rules for a more complex setting.
No comments:
Post a Comment