in reply to How to ensure duplicate directory and file tree, but not file contents themselves?

Another idea would be File::Slurp::Tree, although getting the remote hash would require some serialization. But it will put the Trees into hash structures, which would allow you to use all of the hash comparison techniques available.
#!/usr/bin/perl use warnings; use strict; use File::Slurp::Tree; # The tree datastructure is a hash of hashes. The keys of # each hash are names of directories or files. Directories # have hash references as their value, files have a scalar # which holds the contents of the file. my $dir = shift || '.'; my %tree; my $tree = slurp_tree($dir); my $depth = 0; print "$dir\n"; print_keys($tree); sub print_keys { my $href = shift; $depth++; foreach ( keys %$href ) { print ' ' x $depth, "--$_\n"; print_keys( $href->{$_} ) if ref $href->{$_} eq 'HASH'; } $depth--; }

I'm not really a human, but I play one on earth. Cogito ergo sum a bum
  • Comment on Re: How to ensure duplicate directory and file tree, but not file contents themselves?
  • Download Code