From 2628ade712408e3fb6575cdd6855955dbfe37ac9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 3 Nov 2003 10:14:26 +0000 Subject: useful to create xxx.list using xxx.dir and the output of nfs-accesses --- move/tools/busy-files-accesses | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 move/tools/busy-files-accesses (limited to 'move/tools') 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); -- cgit v1.2.1