Adding a folder to a zip file

How can I add a folder to a zip file. What I want is to create a txt file, which I place in a regular folder,  then place the regular folder in a zipped folder. They all (folder, file , and zip) need to be the same name also, so the directory would be as an example C:\Desktop > runner.zip > runner > runner.txt or something similar. So far I can create a zip file, and I can create a regular folder and place the txt document in the regular folder, but i cannot seem to be able to put the regular folder in the zip folder. I get an error saying: "LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @." It creates the zip file, and also the other folder with the txt file in it, but it wont put the regular folder in the zip file.
Thanks ahead of time

lvuser333 wrote:
are you using the example file or the same code as the above screen shot? So i think my problem is I have been trying to addd the folder to a zip file I created, whereas I think that if I just zip up the folder that has the txt file in it, I will then have a zip file which contains a folder which contains the txt file, is this correct?
I'm using the code in the screenshot (I whipped up the example quickly to see if I could get it to work, so it probably isn't the best or cleanest way to do it).
[The example code from NI should work, but is probably more than you need].
You zip files, but you tell the VI which folder within the zip file (i.e. relative to the zip file) you want them to go in.
Just like how you might have a folder tree on your C drive
animals
->mammals
---->four_legs
-------->delicious
-------->thinks_you_are_delicious
---->two_legs
->birds
---->can_fly
---->cannot_fly
->fish
---->salt_water
---->fresh_water
You can have the same structure in the zip file.
For instance a photo of a flathead (a type of salt water fish)..
the file might be flathead.jpg with the path within the zip would be fish\salt_water\flathead.png
on the other hand a tiger photo
the file would be tiger.png but the path would be mammals\four_legs\thinks_you_are_delicious\tiger.p​ng

Similar Messages

  • I have a Probook running 10.7.5 and have compressed the 60Gb MobileSync folder into a zip file that is... 60Gb, the original file is still there so I have just lost another 60Gb of space.  What's going on?

    I have a Probook running 10.7.5 and have compressed the 60Gb MobileSync folder into a zip file that is... 60Gb, the original file is still there so I have just lost another 60Gb of space.  What's going on?

    Habibullah Allah Yar.
    Kabul Afghanistan.
    Head of Green Shaheen Group of Company's.
    Website: www.gsls-c.com.
    <Personal Information Edited by Host>

  • Missing folder structure in zip file from Theme Editor

    Hi all gurus!
    I have an interesting problem with this background: I want to change the customer brand image in the portal header and do som other modifications. For this reason I have made a copy of one of the standard portal themes, as I'm supposed to do, and I have downloaded that zip file from the portal.
    When unzip this file i get the following files: its.zip, log.html, metadata.properties, portal.zip and upgrade.xml. As I have understood it that is the correct content. Now I'm supposed to unzip the file "portal.zip" and reach amongst other folders the one named "prtl". In this one there is a folder named "images" and under that one is "header" found and in THAT folder the change of picture is done.
    Now for the problem: when I unzip "portal.zip" I just get the content of some property file, NO folders what so ever! If I try to unzip "its.zip" I can see the folder structure under that folder!
    If I open the structure with Total Commander I can see the missing folders! But I can't do the copying of the image, the whole structre gets duplicated when I save! I thought the zip file was corrupt so I made another copy and downloaded it but with the same result!
    Has anyone had the same problem???
    Best regards
    Benny Lange

    Problem solved! By 7-zip. It was actually XP's integrated zip tool that just didn't show the underlaying structure. And Total Commander also did the work if used in the same way as 7-zip, but to edit the second level zip file directly did not work as TC opened that file in a temp directory instead of continuing at the level of the first zip file. That kind of editing directly in a file two zip levels down actually worked in TC 6.x but now I have 7.05 and perhaps things has changed.

  • Compressing a folder creates two zip files

    I've got a folder called Blanks/ABC FM/SMS/Other and when I compress it I get two zip files of the same size: one with the correct name and the other called Archive.zip. When I remove the space I only get the Archive.zip. When I remove the slashes I get the correct zip file only.
    Is this a bug that I should report? How?

    If you were expecting C/D to compress to C/D.zip instead of Archive.zip I think I have an explanation for that.
    The unix file system which is the underlying OSX file system uses slash (/) as a path delimiter.  So to use an example like yours, if you create a folder A on the desktop and B within A then that the pathname is A/B.  But in reality, being on your desktop it is /Users/you/A/B, where you is your user id.
    The finder tries to allow as many characters as it can for filenames.  But the slash it cannot allow in a filename when recorded in the file system.  So what it does is actually change the slash to a colon in the actual filename.  Thus the filename "A/B" in the finder is, in reality, "A:B" in the file system.
    I think this colon-equals-slash naming convention is what causing the finder's Compress to treat the name specially and it just changes it the output to be the generic Archive.zip.
    Compress is there as a convenience.  There's lots of other ways to do zips.  There's third party utilities.  There's zip command in the terminal (where you can play the finder's game and generate A:B.zip so that it displays in the finder as A/B.zip).

  • Pickup and process zip file in watch folder

    Hi,
    Could someone refer me to an example where it shows me how to use Java script in the Execute Script service to do the following:
    - Pickup the zip file from the Watch Folder
    - Unzip the zip file
    - Loop through all the folders, look for the documents and store them in the list document variable in the process
    Thank you in advance for the help!
    Hai

    You can certainly remove that file. it's basically the cached applet demo.jar (the JRE caches the downloaded jars so that you don't have to keep re-downloading them each time you visit the web site).
    The fact that your Antivirus complains about it just means that it's confused. We're all using the Sun environment, and I have the latest and greatest Norton, and there are no complaints, so it's clear that your Antivirus software needs a fix.

  • How to extract a folder (and its contents) from inside a zip file?

    There is a zip file which contains a folder inside it. The folder itself contains a few files. I would need to know how to extract the folder (with its contents) from inside a zip file.
    I have found a few unzipping code samples which show how to handle a folder inside a zip file. An example is shown below:
    public static void extract(String workingDirectory, byte[] zipFile)
    throws Exception {
    ByteArrayInputStream byteStream = new ByteArrayInputStream(zipFile);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ZipInputStream zipStream = new ZipInputStream(byteStream);
    ZipEntry zipEntry = null;
    String nameZipEntry = null;
    byte[] contentZiphttp://forum.java.sun.com/post!default.jspa?forumID=31#
    Click for code tagsEntry = null;
    boolean isDirectory = false;
    int indexFileSeparator = -1;
    String directory = null;
    String fileName =  null;
    while ( (zipEntry = zipStream.getNextEntry()) != null )
                nameZipEntry = workingDirectory + File.separator + zipEntry.getName();
                isDirectory = zipEntry.isDirectory();
                if (isDirectory) {
    File file = new File(nameZipEntry);
    file.mkdirs();
                else
                    // read zipEntry
                    byte[] buf = new byte[1024];
                    int c = 0;
                    while ( (c = zipStream.read(buf)) != -1)
                        out.write(buf, 0, c);
                    indexFileSeparator = nameZipEntry.lastIndexOf(File.separator);
                    directory = nameZipEntry.substring(0, indexFileSeparator);
                    fileName =  nameZipEntry.substring(indexFileSeparator+1,nameZipEntry.length());
                    FileSystemTools.createFile(directory, fileName, out);
                    out.reset();
                    zipStream.closeEntry();
            zipStream.close();
            byteStream.close();
    }The code sample which deals with the part where the zipEntry is a directory creates a directory with the same path and name. (highlighted in bold)
    Another similar variation is:
    File file = new File(dirDestiny.getAbsolutePath() + File.separator + zipEntry.getName() );
    if(zipEntry.isDirectory())
          file.mkdirs();When the code creates a directory for the folder, does it unzip the contents inside the folder as well?
    If not, how do I extract the files inside the folder?

    Have you already tried to see if the sample code you downloaded works or not? Maybe if you try out the code yourself you can see if it extracts files from a directory within a zip file?
    I like to use pkzip. It is a command line compression/uncompression tool that can be used from a batch file. If you assignment involves unzipping large amount of zip files on a regular basis, I recommend taking a look at pkzip.

  • Acrobat 9 tries to open all .zip files

    Acrobat 9 tries to open all zip files I attempt to download - not just zipped PDF's. Under folder management, the zip file type is not associated with Acrobat and is not showing with a PDF icon. The zip file will not open in any unzipping program, it just goes to Acrobat.
    When I download any zip file I get a message like this:
    Acrobat could not open "somefilename.zip" because it is either not a supported file type or because the file has been damaged.
    This happens with every zip file - how do I disassociate Acrobat from all zip file types?

    You need to change the file type association in Windows Explorer of the Folders Control Panel.
    The easiest way would to use Windows Explorer to find a file with the ".ZIP" file extension and then use the right mouse click to bring up the context menu. You can then select the "Open With..." option, make sure you check the option to set the 'always associate' (it is the only option) and then find WinZip, PKZip, RAR, or what ever program you use to open the "ZIP" type file.

  • Sending Downsized Images to Zip File Problems

    I use Adobe Elements 5.0 and have been uploading images to the organizer for a couple of years without problems, until just recently.  Here is how the process used to work.  When images are uploaded they are saved to a new file folder under C drive/ Public Photos/ specific folder with date and subject matter;  I fix the images in adobe then go to the specific folder and create a subfolder within that folder called "downsized".  I then use Adobe to "process multiple files" and downsize for purposes of sending to Pbase. Once the files have been downsized the images end up in the specifc folder, inside the downsized subfolder.  I then rt click and select "send to" 'compressed (zip) folder'.  From there I would open Pbase and upload the zipped folder to a new gallery.
    Recently everything has been fine until I get to the send to zip folder.  Instead of sending to the familiar yellow zip folder it is being sent to the adobe photoshop editor in the form of the adobe icon.  I click on that and it promts me for filename, width, height, resolution and color mode.  I am unable to upload this zipped file version to Pbase.  Previously, when things were operating correctly, I would have a folder, with a subfolder under that called downsized.  Within the downsized folder would be the zipped file for sending to Pbase.  Something has happened recently so that I am ending up with a folder, a subfolder called downsized a sub 'folder' under that which is the adobe elements icon and a downsized file under that which is a copy of the downzied photos in the first downsized file.  In checking out all of my 100 or so folders all of them have been 'converted" to the same organization pattern.  What has happened and how do I fix the problem so that I can send the downsized folder to a zip file for importing to Pbase?  Thank you. 

    You should realize I am just making wild guesses at your problem. And I am assuming you actually have a Microsoft Word document that you are sending. If you do, then following menu options "Insert, Picture, From File..." should work. But if you are just writing out HTML and telling the browser it's actually a Word document, I have no idea.

  • File to mail scenario with zip file as an attachment

    Hi experts,
    I have a file to mail scenario.The mail contains a zip file as an attachment.
    The file in the input folder is a zip file. I want to send this zip file via email using mail adapter.How can i achieve this?Please help me to solve it out.
    Regards
    Divia

    Hi Narath,
    Do check the below link it will be helpfull
    Troubleshooting SOAP, HTTP and Mail Adapter Scenarios with TCPGateway
    Thanks
    Sampath

  • Zip files compatible with windows

    window error when using Mac zip file "too many files"

    If you select a single text file, then right-click on it and select Compress, I would expect this to produce a ZIP file containing just a single file i.e. the text file.
    If however you select a folder then the ZIP file would contain not only the folder, the obvious files in the folder, but may also contain some invisible files like .DS_Store
    Ok, the above is what I expected, I have just been testing this and this is actually what happens. A single file e.g. a text file when made in to a ZIP by right-clicking and selecting compress produces a ZIP file which contains the following
    thetextfile.txt <--- (the text file)
    __MACOSX <--- (an invisible folder)
    __MACOSX/._thetextfile.txt (an invisible file in the invisible folder, this is not the text file itself)
    So, yes it is more than one file in the ZIP file. By the way, you can 'see' what is in a ZIP file by using Terminal.app and typing the following
    zipinfo nameofzip.zip
    You can use Terminal.app also to create a 'clean' ZIP file containing just the text file the command looks like this
    zip nameofzip.zip thetextfile.txt
    Then to check do the zipinfo command again.
    There is also a a commercial tool do simplify doing this, funnily enough it specifically mentions the __MACOSX folder etc. See http://gotoes.org/sales/Zip_Mac_Files_For_PC/

  • Zipping files in a folder using java.util.zip

    hi guys,
    does any body has the java code for
    zipping files in a folder
    hi guys,
    actually i want to zip no of files in a folder .the folder can also have sub folder
    and after zipping when i extract the files manually i should
    maintain the same folder structure
    does any body has the code
    please reply me soon its a bit urgent

    hi smeee
    i tried running ur code but its not working
    here the command
    java c:\abc\ zzz.zip
    its saying
    no files or directories even though there's the
    directory present
    what's the solution Hi,
    Oops that was because of the error check added at the last moment..
    Anyway, You need to use the following command to run it :
    java ZipUtility c:\abc c:\zzz.zip
    Please use the following corrected code:
         Class to zip file(s).
         Requires jdk1.3.1.
         To run use the following command:
         java ZipUtility <directory or file to be zipped> <name of zip file to be created>
         Please specify absolute path names as its parameters while running this program.
    import java.util.zip.*;
    import java.io.*;
    public class ZipUtility {
         ZipOutputStream cpZipOutputStream = null;
         String strSource = "";
         String strTarget = "";
         String strSubstring = "";
         public static void main(String args[]) {
              if(     args == null || args.length < 2) {
                   System.out.println("Usage: java ZipUtility <directory or file to be zipped> <name of zip file to be created>");
                   return;
              ZipUtility udZipUtility = new ZipUtility();
              udZipUtility.strSource = args[0];
              udZipUtility.strTarget = args[1];
              udZipUtility.zip();
         private void zip(){
                        try
                             File cpFile = new File (strSource);
                             if (!cpFile.isFile() && !cpFile.isDirectory() ) {
                                  System.out.println("\nSource file/directory Not Found!");
                                  return;
                             if  (cpFile.isDirectory()) {
                                  strSubstring = strSource;;
                             } else {
                                  strSubstring = "";
                             cpZipOutputStream = new ZipOutputStream(new FileOutputStream(strTarget));
                             cpZipOutputStream.setLevel(9);
                             zipFiles( cpFile);
                             cpZipOutputStream.finish();
                             cpZipOutputStream.close();
                             System.out.println("\n Finished creating zip file " + strTarget + " from source " + strSource);
                        }catch (Exception e){
                             e.printStackTrace();
         private void  zipFiles(File cpFile) {
                   if (cpFile.isDirectory()) {
                        File [] fList = cpFile.listFiles() ;
                        for (int i=0; i< fList.length; i++){
                             zipFiles(fList) ;
                   } else {
                        try {
                             String strAbsPath = cpFile.getAbsolutePath();
                             String strZipEntryName ="";
                             if (!strSubstring.equals("") ){
                                  strZipEntryName = strAbsPath.substring(strSource.length()+1, strAbsPath.length());
                             } else {
                                  strZipEntryName = cpFile.getName();
                             byte[] b = new byte[ (int)(cpFile.length()) ];
                             FileInputStream cpFileInputStream = new FileInputStream (cpFile) ;
                             int i = cpFileInputStream.read(b, 0, (int)cpFile.length());
                             ZipEntry cpZipEntry = new ZipEntry(strZipEntryName);
                             cpZipOutputStream.putNextEntry(cpZipEntry );
                             cpZipOutputStream.write(b, 0, (int)cpFile.length());
                             cpZipOutputStream.closeEntry() ;
                        } catch (Exception e) {
                             e.printStackTrace();

  • I am trying to organize a zip file with a bunch of links and files. But when I drag an image file to a folder, it always "Snaps to grid" instead of just landing where I put it.

    I am trying to organize a zip file with a bunch of links and files. But when I drag an image file to a folder, it always "Snaps to grid" instead of just landing where I put it. All of the files are going into the same zip file but I want them visually in the space that I put them and not at the bottom of the snap to grid folder location they are looking like.  I am trying to  drag and drop files in groups so that I can group them for now, but image files always do their own "sort by" when I drag them from my web pages. Links don't do it though.  I tried resetting the folder, and deleting the DS files. No luck.

    You keep asking variants on this same question. You've had replies in all your other threads. If you can't find them, go here and click where it says Activity:
    Thomas Cannon Jr.

  • Adding zip file to classpath or -Xbootclasspath on J9

    Hi,
    I'm trying to add a zip file containing javax classes (jscience-vm14.zip) to the classpath when running my program. I haven't had any problems adding jar files for instance, but I can't seem to have this zip file included so that it can be recognized by the jvm.
    I've noticed in the installation document of the J9 that if you want to add javax classes it has to be put on the -Xbootclasspath. So I've tried including the zip file using -Xbootclasspath/p:path/to/zipfile/zipfile.zip and I've tried -Xbootclasspath/a:path/to/zipfile/zipfile.zip. I've also tried just including it in the classpath with no luck either. I keep getting a NoClassDefFoundError: javax.units.Unit which is part of the jscience package
    Any ideas how to get the zip file included?
    Kind regards
    Simon

    Hi,
    Thank you for your answer!
    I'm using SWT and here's the code:
    lstBread.addListener (SWT.Selection, new Listener () {
                   public void handleEvent (Event e) {
                   System.out.println("Widget selected!");
    It's working wtihout error on win32 platform. But there is no call on Windows Mobile 5.0 platform. It doesn't run and no exception is throwed on J9 console.
    However, when i use the same way for event handling in SWT Button, there is no problem both on WM5 and win32 platform. It's executed as i want.
    The code for SWT Button:
    btnSView.addListener (SWT.Selection, new Listener () {
                   public void handleEvent (Event e) {
         System.out.println("Widget selected!");     
    I couldn't find the reason of that. Why doesn't the list#addListener run on WMobile?
    Best Regards,
    Ceyhun Hallac

  • Hello, I am attempting to install Camera raw from a .zip file provided via a link provided by adobe for a Nikon D810. The .zip file unzips fine and I moved the files to the recommended folder. But the operation is failing

    I am attempting to install Camera raw from a .zip file provided via a link provided by adobe for a Nikon D810. The .zip file unzips fine and I moved the files to the recommended folder. But the operation is failing

    Can you describe what “the operation is failing” means?  What is happening and how is it different than what you expect?
    Also, what product are you trying to update manually, and do you have a link to the page of instructions, so we know what your attempting to do?

  • Can I search zip files for a particular substring in the name and extract the file to a folder?

    I need to search through lots of zip files, looking for files starting with a particular string.  Then extract them to any folder.  Can I do this in CVI?
    thanks

    thanks Wolfgang, but my level of experience is such that I could use a bit more detail.  Do you mean that I might find a .dll and call one of its functions from CVI?   So you know of nothing in CVI that I can use directly?  I don't think that I would want to open the zip, extract all the files, search the folder where they were extracted to, copy the file if it has the target name substring, then rezip.  Or, maybe there is a more direct solution.
    Any thoughts?
    thanks

Maybe you are looking for