G
GU
first of all i don't know if this is the proper group to discuss this
problem, but i can't find a better one.....
I'm using "SunOS h213 5.9 Generic_122300-29 sun4u sparc SUNW,Sun-
Fire-15000" (uname -a) and perl v5.6.1 and want to copy a lot of files
to a remote host. So i'm looking up for those files using find:
rsync -avz `find * -prune -type d -mtime -30|grep -v archive`
user@remote:dir
To add some funtionality (logging, mail if completed e.g) i'd like to
do this with perl.
Now i gonna try to convert find to a perl script using find2perl.....
and will have some problems:
gm@h213:/tmp ># redirect STDERR to avoid warnings caused by
permissions
gm@h213:/tmp >find * -prune -type d -mtime -30 2>/dev/null | tail -2
tmpdir.21790
tmpdir.27721
gm@h213:/tmp >
gm@h213:/tmp >find2perl -prune -type d -mtime -30 | perl
Found = in conditional, should be == at - line 26.
gm@h213:/tmp >
line 26 is that one with prune-check, but if using only -prune those
error does not occur (but i still have different results)
gm@h213:/tmp >find * -prune 2>/dev/null | tail -2
wkz_adj_maf
wkz_adj_rep.csv
gm@h213:/tmp >find2perl -prune | perl
gm@h213:/tmp >
One solution for me is to glob "*". As far as i can see glob "*" and
`find * -prune` will produce the same output. So i will be able to
find the files i need by 'grep {(-d $_ && (int(-M $_) <30))} glob "*"'
But that's not that what i want to use. If i've tools like find2perl i
wanna use those ones.
So what's the problem and how can i use the find2perl-result.
Do you know what's to do?
Thanks
gerhard
p.s. enclose the output of 'find2perl * -prune -type d -mtime -30'
gm@h213:/tmp >find2perl * -prune -type d -mtime -30
#! /usr/local/bin/perl -w
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell
use strict;
use File::Find ();
# Set the variable $File::Find::dont_use_nlink if you're using AFS,
# since AFS cheats.
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find:rune;
# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, **** list of files **** );
exit;
sub wanted {
my ($dev,$ino,$mode,$nlink,$uid,$gid);
($File::Find:rune = 1) &&
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
-d _ &&
(int(-M _) < 30);
}
gm@h213:/tmp >
problem, but i can't find a better one.....
I'm using "SunOS h213 5.9 Generic_122300-29 sun4u sparc SUNW,Sun-
Fire-15000" (uname -a) and perl v5.6.1 and want to copy a lot of files
to a remote host. So i'm looking up for those files using find:
rsync -avz `find * -prune -type d -mtime -30|grep -v archive`
user@remote:dir
To add some funtionality (logging, mail if completed e.g) i'd like to
do this with perl.
Now i gonna try to convert find to a perl script using find2perl.....
and will have some problems:
gm@h213:/tmp ># redirect STDERR to avoid warnings caused by
permissions
gm@h213:/tmp >find * -prune -type d -mtime -30 2>/dev/null | tail -2
tmpdir.21790
tmpdir.27721
gm@h213:/tmp >
gm@h213:/tmp >find2perl -prune -type d -mtime -30 | perl
Found = in conditional, should be == at - line 26.
gm@h213:/tmp >
line 26 is that one with prune-check, but if using only -prune those
error does not occur (but i still have different results)
gm@h213:/tmp >find * -prune 2>/dev/null | tail -2
wkz_adj_maf
wkz_adj_rep.csv
gm@h213:/tmp >find2perl -prune | perl
gm@h213:/tmp >
One solution for me is to glob "*". As far as i can see glob "*" and
`find * -prune` will produce the same output. So i will be able to
find the files i need by 'grep {(-d $_ && (int(-M $_) <30))} glob "*"'
But that's not that what i want to use. If i've tools like find2perl i
wanna use those ones.
So what's the problem and how can i use the find2perl-result.
Do you know what's to do?
Thanks
gerhard
p.s. enclose the output of 'find2perl * -prune -type d -mtime -30'
gm@h213:/tmp >find2perl * -prune -type d -mtime -30
#! /usr/local/bin/perl -w
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell
use strict;
use File::Find ();
# Set the variable $File::Find::dont_use_nlink if you're using AFS,
# since AFS cheats.
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find:rune;
# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, **** list of files **** );
exit;
sub wanted {
my ($dev,$ino,$mode,$nlink,$uid,$gid);
($File::Find:rune = 1) &&
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
-d _ &&
(int(-M _) < 30);
}
gm@h213:/tmp >