Skip to content

Extract only certain files from zip #460

@ggrothendieck

Description

@ggrothendieck

I am currently doing this to only extract csv files from a zip file and wondered if there is a more direct way of doing this? Would have been nice if which= could be a pattern (regular expression or glob).

import_csvs_from_zip <- function(x, ...) {
  filenames <- rio:::.list_archive(x)
  csv_names <- grep("\\.csv$", filenames, value = TRUE)
  import_list(x, which = csv_names, ...)
}

import_csvs_from_zip("myzip.zip", rbind = TRUE)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions