% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/datasus_catalog.R
\name{datasus_list_files}
\alias{datasus_list_files}
\title{List available DATASUS files}
\usage{
datasus_list_files(
  source,
  file_type,
  year = NULL,
  month = NULL,
  uf = NULL,
  include_prelim = TRUE,
  check_exists = TRUE,
  timeout = 120,
  ftp_use_epsv = FALSE,
  verbose = TRUE
)
}
\arguments{
\item{source}{Character vector of source codes.}

\item{file_type}{Character vector of file type codes.}

\item{year}{Integer vector of years.}

\item{month}{Integer vector of months (required for monthly sources).}

\item{uf}{Character vector of UF codes (required for UF-scoped sources).}

\item{include_prelim}{Logical. Include preliminary data trees (default \code{TRUE}).}

\item{check_exists}{Logical. Query the FTP and keep only files that exist
(default \code{TRUE}). Setting to \code{FALSE} skips FTP access and returns all
candidate files.}

\item{timeout}{Timeout in seconds for FTP requests (default 120).}

\item{ftp_use_epsv}{Logical. Passed to curl (default \code{FALSE}).}

\item{verbose}{Logical. Emit progress messages (default \code{TRUE}).}
}
\value{
A tibble with one row per file, including its FTP URL and metadata.
}
\description{
Builds candidate file names from the internal catalog and, optionally,
validates them against the DATASUS FTP.
}
\examples{
\donttest{
tryCatch(
  datasus_list_files(
    source    = "SIHSUS",
    file_type = "RD",
    year      = 2024,
    month     = 1,
    uf        = c("PE", "PB"),
    verbose   = FALSE
  ),
  error = function(e) message("FTP unavailable: ", conditionMessage(e))
)
}
}
