I have a .zip created on a Windows machine (outside of my control). The zip file contains paths that I need to preserve when I unzip.
However, when I unzip, all files end up like:
unzip_dir/\window\path\separator\myfile.ext
I've tried both, with and without -j
option.
My issue is that I need that path information under \window\path\separator\
. I need that file structure to be created when I unzip.
I can mv
the file and flip the \
to /
easily enough in a script, but then there are errors that the destination path directories do not exist. My workaround for now is to mkdir -p
the paths (after converting \
to /
) and then cp
the files to those paths.
But there are a lot of files, and these redundant mkdir -p
statements for every file really slows things down.
Is there any more elegant way to convert a zip file with Windows paths to Linux paths?
unzip -j -d
options. See Forcing Unzip - No Paths – eyoung100 Nov 05 '14 at 17:04-j
, I still get filename\window\path\separator\myfile.ext
cause Linux/Zip don't treat it as a paths. And I have absolutely no control over the zip file creation. – Slav Nov 05 '14 at 17:25not recognized
. – eyoung100 Nov 05 '14 at 17:35