Note that there are some explanatory texts on larger screens.

plurals
  1. POPerl File::Find duplicate names
    text
    copied!<p>I'm using Perl's module File::Find to traverse across a directory. This directory is an NFS share which has the directory .snapshot. In this folder there's a snapshot of yesterdays file structure and thus it has directories with the same name in the result. I therefore get the following error:<br/></p> <pre><code>[folder_in_which_find_is_executed].snapshot/sv_daily.0 encountered a second time at /usr/lib/perl5/5.8.8/File/Find.pm line 566. </code></pre> <p>Is there a way to prevent this from happening e.g. by removing the duplicate entry?</p> <p>This is the code sub that executes the find:<br/></p> <pre><code>sub process() { my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat $_; my $type = (-f _ ? 'f' : (-d _ ? 'd' : '*')); my ($md5sum); if (!defined $dev) { if (-l $_) { die "Broken symbolic link: $File::Find::name"; } else { die "Error processing $type '$File::Find::name'"; } } my $name = $File::Find::name; $name =~ s|^\.\/?||; if ($name ne '') { $db-&gt;{$name} = { name =&gt; $name, mode =&gt; sprintf("%04o", $mode &amp; 07777), user_id =&gt; $uid, group_id =&gt; $gid, last_modified =&gt; $mtime, type =&gt; $type }; if ($type eq 'f') { $db-&gt;{$name}-&gt;{size} = $size; $db-&gt;{$name}-&gt;{inode} = $ino; $md5sum = SumForEntry($name, $_); $db-&gt;{$name}-&gt;{md5sum} = $md5sum; } } } </code></pre> <p>The following line executes this sub:</p> <pre><code>find({ wanted =&gt; \&amp;process, follow =&gt; 1}, '.'); </code></pre> <p>Can somebody please help me?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload