Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a small set of files I develop on Windows but need to extract and run on Linux. One of those files is a script, StartApp.sh. I'm packaging the files as a zip archive, passing it to my admin, and asking him to manually set the execute attribute on StartApp.sh before running it.

Is there an archive tool (that runs on Windows) that I can set the "execute attribute" in the archive or zip file itself? (So when it is extracted on Linux the script will execute without manual steps.)

share|improve this question

3 Answers 3

up vote 1 down vote accepted

As far as I know, there is no such tool, unless you use Cygwin on Windows, a Linux-like environment for Windows.

Your other options are:

  • Create an unpack script for your zip that will set the execute permission
  • Use a version management system to transfer files, rather than zip
share|improve this answer
    
After a long hiatus I've revisited this issue. We're using TFS for our source code management, and 'TFS Everywhere' has a method of automatically setting the execute attribute (tracked in a separate meta file per directory). This answer came closest to the solution I used. –  yzorg Mar 21 '11 at 23:45

If you're willing to do a little bit of work, it is possible to write a Python script to do this, using zipfile. The trick is to frob the ZipInfo.external_attr member for the file in question before using ZipFile.writestr() to add it to the archive. See the source of ZipFile.write() for the exact manipulation you need to perform.

    zinfo.external_attr = (st[0] & 0xFFFF) << 16L      # Unix attributes
share|improve this answer

I wouldn't count on finding an archive utility that lets you do that natively (if the native filesystem doesn't do it, getting an app to do it is unlikely)...my fallback and punt answer for most things windows/linux crossover is cygwin

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.