diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-11-03 10:14:26 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-11-03 10:14:26 +0000 |
commit | 2628ade712408e3fb6575cdd6855955dbfe37ac9 (patch) | |
tree | c16f1105b0bf84063ad72f7c64e750f5bb56c36a /move/tools/busy-files-accesses | |
parent | a9c6734511a1e42c0957785dab6626597645a299 (diff) | |
download | drakx-backup-do-not-use-2628ade712408e3fb6575cdd6855955dbfe37ac9.tar drakx-backup-do-not-use-2628ade712408e3fb6575cdd6855955dbfe37ac9.tar.gz drakx-backup-do-not-use-2628ade712408e3fb6575cdd6855955dbfe37ac9.tar.bz2 drakx-backup-do-not-use-2628ade712408e3fb6575cdd6855955dbfe37ac9.tar.xz drakx-backup-do-not-use-2628ade712408e3fb6575cdd6855955dbfe37ac9.zip |
useful to create xxx.list using xxx.dir and the output of nfs-accesses
Diffstat (limited to 'move/tools/busy-files-accesses')
-rw-r--r-- | move/tools/busy-files-accesses | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/move/tools/busy-files-accesses b/move/tools/busy-files-accesses new file mode 100644 index 000000000..72dbc119b --- /dev/null +++ b/move/tools/busy-files-accesses @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +use MDK::Common; +use Getopt::Long; + +GetOptions('no-link' => \ (my $no_link), + 'no-dir' => \ (my $no_dir), + 'full-dirs=s', \ (my $full_dirs), +); + +if ($full_dirs) { + my @l = map { chomp_(MDK::Common::File::cat_or_die($_)) } split(' ', $full_dirs); + $full_dirs = '/tmp/live_tree(' . join('|', map { quotemeta } @l) . ')/'; +} + +my ($file_list) = @ARGV; +foreach my $file (cat_($file_list)) { + chomp $file; + + $file =~ m!/tmp/live_tree! or next; + + if (-l $file ? !$no_link : -d $file ? !$no_dir : 1) { + my $s = $full_dirs && $file =~ /^$full_dirs/ ? "/tmp/live_tree$1" : $file; + push @l, $s; + } +} + +print "$_\n" foreach uniq(@l); |