#!/usr/bin/perl
$find_dir = '.';
$to_dir = '/tmp/test';
foreach(glob("$find_dir/*"))
{
print "checking $_ \n";
$link_path = readlink($_);
if($link_path ne '')
{
print "..found symlink $link_path \n";
if($link_path =~ /^$to_dir/)
{
print "....found matched symlink!\n";
# do something ...
# for example delete found file
# unlink($link_path)
}
}
}
drwxrwxr-x 2 dt dt 4096 сен 16 12:08 1
lrwxrwxrwx 1 dt dt 4 сен 16 12:18 2 -> /tmp
lrwxrwxrwx 1 dt dt 9 сен 16 12:18 3 -> /tmp/test
lrwxrwxrwx 1 dt dt 18 сен 16 12:19 4 -> /tmp/test/test.txt
lrwxrwxrwx 1 dt dt 29 сен 16 12:19 5 -> '/tmp/test/tes test test 2.txt'
lrwxrwxrwx 1 dt dt 29 сен 16 12:19 'tes test test 2.txt' -> '/tmp/test/tes test test 2.txt'
-rwxr-xr-x 1 dt dt 387 сен 16 12:22 test.pl
Выдает следующее:checking ./1
checking ./2
..found symlink /tmp
checking ./3
..found symlink /tmp/test
....found matched symlink!
checking ./4
..found symlink /tmp/test/test.txt
....found matched symlink!
checking ./5
..found symlink /tmp/test/tes test test 2.txt
....found matched symlink!
checking ./tes test test 2.txt
..found symlink /tmp/test/tes test test 2.txt
....found matched symlink!
checking ./test.pl
/system scheduler add interval=1d name=ntp-servers-refresh on-event="/system ntp client set primary-ntp=[:resolve time.windows.com] secondary-ntp=[:resolve ru.pool.ntp.org]" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-
date=nov/18/2019 start-time=02:15:35
modprobe nf_conntrack
iptables -A OUTPUT -s ip_сервера -m state --state established,related -j ACCEPT
iptables -A OUTPUT -s ip_сервера -m state --state new,invalid -j DROP
conntrack -F