#!/usr/bin/perl $dir = "/root/dir"; opendir(DIR, $dir) or die "Can't open $dir: $!"; my @files = grep { -T $_ } readdir DIR;