my $path = "/whatever/path"; { local $/ = "\0"; open( FIND, "find $path -print0 |" ); while () { chomp; # do something with this name... } }