Re: [Ssh-sftp-perl-users] Exclude directories in $sftp->ls()??
Brought to you by:
dbrobins
From: Fredrik S. <str...@gm...> - 2008-01-29 14:25:12
|
NWM next if ($_->{longname} =~ /^d/); did the trick. (sorry if i spam, dont know how to edit/resume on my last post) Best Regards plura On Jan 29, 2008 2:58 PM, Fredrik Stridfeldt <str...@gm...> wrote: > Hello! > > Iam writing a script for automated download and send of files using NET:SFTP. > Just ran into following problem: > > In my sub for fetching files i do like this to figure out what files > are present in the directory on the remote server. > > foreach ($sftp->ls($ddir)) { > next if ($_->{filename} =~ m/^\./); > next if (-d "$ddir\/$_->{filename}"); > push(@files, $_->{filename}); > } > return (@files); > > I exclude . and .. but to exclude the directories i have no success. I > use the same loop with (-d) for excluding directories locally when i > send files and that works with a smile.. > > Best Regards > plura > |