unzip: gives: checkdir error: .../directory exists but is not a directory

13,027

The problem is with Cygwin. It interprets the existence of "tld.exe" as "tld" also existing. unzip is probably just using a standard stat call to check if "tld" already exists and check if it is a directory. stat is probably saying yes "tld" exists (because "tld.exe" exists)

touch testfile.exe
if [ -f testfile ] ; then echo y ; else echo n; fi 

On a normal linux type system you would expect the above to answer 'n'. However on cygwin, the result is 'y'.

This is part of cygwin's mechanism to allow windows .exe files to be executed without the .exe in the command.

See: https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-exe

Share:
13,027
Ray
Author by

Ray

Updated on June 04, 2022

Comments

  • Ray
    Ray 11 months

    My team produces a build.zip file using windows that I want to do some post processing on using cygwin/bash script, unzipping it, and then doing further processing.

    I can use the Windows 7 GUI "Extract All" and everything works fine -- extraction works, getting into the "problem directory" is no problem. Everyone has been doing that for ages.

    The directory it is complaining about contains .obj and .md files. In a bash shell I can go to it and list it and all is good (list it after Windows extracted it). But using the unzip command, I can't extract this part of the build.zip. I get the following error (and the preceding success before it):

      inflating: bld_731/build_20150731/GVII/Software/_bld/rel/tcf/TscControlFmtCtrl.obj
      inflating: bld_731/build_20150731/GVII/Software/_bld/rel/tdl.exe
      checkdir error:  bld_731/build_20150731/GVII/Software/_bld/rel/tdl exists but is not directory
                     unable to process build_20150731/GVII/Software/_bld/rel/tdl/.
           ...
     checkdir error:  bld_731/build_20150731/GVII/Software/_bld/rel/tdl exists but is not directory
                 unable to process build_20150731/GVII/Software/_bld/rel/tdl/CmfCmd.obj.
    

    As you can see, it's both the directory and the files it finds inside the directory.

    Do you know how to resolve this? Do I need to go another extraction utility, perhaps ?? Thanks.