Skip to content

Need better handling for .zip contents with spaces in the file names #14

@ThomasThoren

Description

@ThomasThoren

This is currently handled like this:

unzipped.shp: zipped.zip
    @mkdir -p $(dir $@)

    @# Extract .zip contents to temporary folder
    @mkdir -p tmp
    @unzip -q -o -d tmp $<

    @for file in tmp/*.*; do \
        fullfile=$$(basename "$$file") && \
        fileextension="$${file##*.}" && \
        cp "$$file" "$(dir $@)$*-extracted.$$fileextension" ; \
    done

    @# Delete temporary folder
    @rm -rf tmp

This handles file names that have spaces, but it messes up when two files have the same root name, no matter if that has spaces or not.

For example, name.shp.xml and name.shp would get merged into a single name.xml output file. This function needs to be able to handle file names that contain periods other than the separator between its name and the file type extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions