my $base_url = 'https:// my $user = my $pass = ; #folder change my $out_dir = 'pages'; #format change my $format = 'html'; #pulls all ID's my $out = `curl -u $user:$pass -i $base_url/file/root/tree?format=ids`; #regex saying any number with a comma after it $out =~ /.+\s*([\d,]+)$/; #separate each id by comma my @ids = split /,/, $1; #pull pageid array, create separate HTML file with page contents foreach my $id (@ids) { print "$id\n"; #passes array into $id and makes curl command to get HTML content. my $json = `curl -u $user:$pass -i $base_url/files/$id/contents?format=$format`; $json =~ /^.+\r\n\r\n:?(.+)$/s; my $contents = $1; open(FILE, ">$out_dir/$id.$format") or die "can't open file for $id: $!"; print FILE "$contents\n"; close FILE; }