Automate renaming files within zip archive

I have a large number of files where I need to do the following:
Change the file extension to .zip. (The files are zip archives but with a special extension, and all of the files have their own extension, ie .xx01, .xx02, etc...)
Extract the zip file.
Rename a file within. (Alternatively, it'd be great to be able to rename the file without extracting the zip file.)
Recompress the file.
Set the file extension back to what it was.
I've been playing around in Automator to see if I could create a workflow that would do some or all of this. I've figured out changing the file extension, and Automator has an action to compress a zip file, but the other parts are eluding me.
Does anyone know a way to make this process a little less labor intensive? I'd prefer to automate the whole thing, but even just some way to rename a file in a .zip archive without extracting it first would be hugely helpful. (I know this is possible under Windows.)
I'm comfortable with delving into new territory in Automator, AppleScript, or shell scripts to make this easier.
Thanks!

We had a similar problem
It turned out to be a feature and not a bug
Actually 'vanilla' XP handles those files and is able to open them and it seems that the problem appears only after updating the XP to fix the vulnerability described in:
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-054.asp
What we have determined is that if the zip file contains '/' at the begining of the path - the compressed folder utility will refuse to open it and will show only a blank pane in explorer. Removing the '/' from path in zip file solves the problem on updated Windows XP.

Similar Messages

  • How can I automatically rename files based on an excel doc?

    I am a scientist and recieve data files from some of my experiments with arbitrary, computer-generated names. For example, if I perform an experiment with four samples, which I name Sample1, Sample2, Sample3, and Sample4, I get back 4 data files named J30935D05.ab1, J30935E05.ab1, J30935F05.ab1 and J30935G05.ab1 along with an Excel doc that lists my names for the samples (sample1, sample 2, etc.) in one column and the computer-generated names for their corresponding files (J30935D05.ab1, J30935E05.ab1, etc.) next to them in another. Therefore, I must open the Excel file and look up which file corresponds to which sample before I can begin processsing my data. Usually these experiments involve a large enough number of samples (70-100 or so) such that looking everything up in the Excel doc gets very tedious and is quite time-consuming. Is there any way to create an automator workflow, applescript, or some other solution to rename these files based on the Excel doc? To clarify, I would like an automator workflow that would take a folder of arbitrarily named files, look up the names I have for the samples in the Excel doc, and rename the files accordingly. In the example, my folder containing files J30935D05.ab1, J30935E05.ab1, J30935F05.ab1 and J30935G05.ab1 would be turned into a folder containing the files renamed as Sample1.ab1, Sample2.ab1, Sample3.ab1, and Sample4.ab1. This example is a bit simplified, however, and trying a simple trick of just systematically renaming files within the folder would not work--both the original and the new file names must be looked up in the Excel doc, as these change dramatically from experiment to experiment. I would also need to maintain the file extension on each file after being renamed. Any help would be greatly appreciated!!

    Try the freeware utility Renamer4Mac (VersionTracker or MacUpdate).
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • Files in ZIP Archive not visible in XP explorer

    I have a strange problem. I'm sure the solution is something simple, but I seem to be overlooking it. I am creating a .zip archive from within my Java app, zipping up 5-10 straight text files. From what I can tell the file gets created successfully. After the .zip file is created, I can do a jar -tf on the file and it will show them all to me. I can also programatically get a list of the files in the archive and it all looks correct. However, when I try opening the archive file from the Windows XP file explorer (or extracting it to a location) it says that there are no objects in the archive.
    Here is the code I am using to create the zip file:
       byte[] buf = new byte[1024];
       try {
          String outputFilename = "somefile.zip";  // The output archive
          ZipOutputStream outStream = new ZipOutputStream(new FileOutputStream(outputFilename));
          System.out.println("createZip: zipping "+_files.length+" files.");
          // _files is an array of c:\somedir\somefile.txt file listings
          for (int i=0; i<_files.length; i++) {
            System.out.println("Adding entry: "+_files);
    FileInputStream in = new FileInputStream(_files[i]);
    outStream.putNextEntry(new ZipEntry(_files[i]));
    int len;
    while ((len = in.read(buf)) > 0) {
    outStream.write(buf,0,len);
    outStream.closeEntry();
    in.close();
    outStream.finish();
    outStream.close();
    rv = true;
    // ... catch, return value, etc.
    Any suggestions or hints would be greatly appreciated..

    We had a similar problem
    It turned out to be a feature and not a bug
    Actually 'vanilla' XP handles those files and is able to open them and it seems that the problem appears only after updating the XP to fix the vulnerability described in:
    http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-054.asp
    What we have determined is that if the zip file contains '/' at the begining of the path - the compressed folder utility will refuse to open it and will show only a blank pane in explorer. Removing the '/' from path in zip file solves the problem on updated Windows XP.

  • How to use database file within jar archive

    Hi. I'm quite new in Java programming, and I'm wondering if what I did makes sense or not.
    In my applet I'm using a MS Access Database file, which is contained in the same Jar Archive like the Applet class file. I tried and tried to use this Database file directly but it wouldn't work. Than I read in some other forum that it is not possible to use the database file directly within the archive. First question: Is that true?
    Than I desided to extract the DB file in the init() method of my applet to the default temporary foulder. When the program is closed I use the destroy() method to delete it again. Everything works well now. But is this the typical way this is done?
    Thanks for help!

    Hi,
    here is the code which extracts the database file out of the jar archive (the same archive in which the class file is):
    //get the user temporary folder
    File TempFolder = new File(System.getProperty("java.io.tmpdir"));
    //create (empty) db file
    efile = new File(TempFolder, "steelSections.mdb");
    // if database file is not yet extracted
    if (!efile.exists()) {
    //get an input stream for the database file
    InputStream in = new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(
    "FaST/db/steelSections.mdb"));
    //create an output stream for the db file on the file system
    OutputStream out = new BufferedOutputStream(new FileOutputStream(efile));
    //-Buffer to copy the data
    byte[] buffer = new byte[2048]; //buffer to copy the binary
    for (;;) {
    int nBytes = in.read(buffer); //read data
    if (nBytes <= 0)
    break; //no more data to read
    out.write(buffer, 0, nBytes); //write data
    out.flush(); //close out and in streams
    out.close();
    in.close();
    If you have the db file in an other jar archive file you need a referenze to the entry in the other jar archive. I'm not sure how to get this, but I'm sure you fill find a solution by searching in this forum...
    Good luck!

  • Change file in Zip archive without repacking

    Hi All,
    I have Zip archive. It contains ~100000 files. I needed to change only one file, without repacking all Zip archive.
    How can I do this? Do smb have such situations?

    You can't, using Java. I think that there are 3rd-party products that can. Try searching for one.

  • Create Automator workflow/AppleScript to automatically move files within NAS

    Running iMac / Macbook Air (OS 10.9.5), having the Macs connected wireless to the same network as a Seagate Central (NAS). On the Seagate Central and the iMac I have specified a couple of folders which are bidirectional synced via "Sync folders pro", e.g. pictures/movies folders. As a family, we have several iPhones (4S and 5S) with dedicated folders on the Seagate Central / iMac. Having the Seagate Media app on the iPhones, we are able to upload (and thereby free iPhone memory) pictures/movies directly onto the Seagate Central (pictures/movies which then are synced back onto the iMac). However, when uploading pictures/movies from the iPhone to the Seagate central (via Seagate Media app), it is not possible to define a target directory, and the pictures are therefore uploaded to a dedicated directory. I therefore search for some workflow/script to automatically (when new pictures/movies are uploaded, or at a daily basis);
    - Search for pictures/movies within a specific NAS folder
    - Move the pictures/movies to another specific NAS folder
    - Delete all other files/folders within the NAS folder being searched
    New to Automator / scripting, so I hope you bear with me even if the questions are dumb.
    Is it possible to make the NAS recognize a workflow/script without starting the iMac and/or MBA?

    Ok, so I made it a bit further, now having the following Automator Workflow (iCal)
    1. Get requested clients (check for ignore input from this action)
    - afp://192.168.1.86/Public
    2. Connect to client
    - I end up with a mounted disc (Public folder). Note that I end up at the same folder even if using afp://192.168.1.86/Public/iPhone/Photos in step 1.
    3. Get specified Finder items (check for ignore input from this action - to avoid having the Public folder itself following the workflow)
    - Choose the subfolder Public/iPhone/Photos
    4. Get folder content
    5. Filter Finder items
    - Did not get any results by using arguments as "kind is picture" and/or "kind is movie"
    - Ended up using arguments as "name contains jpg", "name contains mov" etc
    6. Move Finder items
    - Destination folder: Public/Pictures/iPhone
    - I now successfully managed to transfer the pictures and movies from one NAS folder to another
    *** I now want to continue the workflow to delete all other Folders/Files on Public/iPhone/Photos ***
    7. Get specified Finder items (check for ignore input from this action - to have no existing input for the remaining workflow)
    - Choose the subfolder Public/iPhone/Photos
    8. Get folder content
    - Results no showing a folder and a file
    9. Move Finder items to trash
    However, I´m encountering a couple of problems with this workflow;
    Note1: If there are no pictures/movies to move (no output from #5 going into #6), the workflow will stop. Any suggestions on how to skip step #6 and go to #7 if there are no pictures/movies to move? Applescript within Automator? Setting up the workflow as iCal (regular basis), so would be nice if the workflow just completes without errors (i.e. still goes on with deleting other files on the folder, even if there are no pictures/movies to move).
    Note2: Step #9 result in a error "Finder could not move the specified items to trash". Has this something to do with a folder and some other file being attempted deleted from a NAS folder? Any suggestions for how to cope with this problem?

  • Can't view htm file within zip

    I originally created a project in Captivate 2. I recently
    installed Captivate 3 and when I open the project created in cp2
    and republish it using cp3 when I open the zip and click on the htm
    to view it won't open I get a blank screen. Any thoughts?

    Hi AW corp
    You probably won't be able to run directly from the ZIP file.
    You will need to first unzip the package, then run it and it should
    work. If all you are doing is trying to run the HTML page from
    inside the ZIP, it cannot find the other files it needs.
    Cheers... Rick

  • Why does photoshop automatically rename file names when using save for web?

    All of a sudden when choosing Save for Web, when i type in a name for my file in the File Name: dialog box, when you click "save", it saves the selected slices as the name of the document and not what i typed.
    For example: My psd file is called "website header" and i want to save the slices with the name "index". If i save slice-02 or slice-06 it will save as "index_02.jpg" but if i choose slice 01, it will save as "website-header_01"

    Check your settings in the SfW output options and yopur slice names in PS itself.
    Mylenium

  • How to rename files by folder name in applescript

    Hi,
    I need to be able to rename files within a folder to the folder name. I have a work flow and script that allows me to find the files within a folder, enter a new file name and starting sequence number in tow seperate dialogue boxes. What I want to be able to achieve is to rename the files without manually entering the name... I still want to be able to manually enter the number.

    Use code such as:
    tell application "Finder"
    set the_folder to (choose folder)
    repeat with this_file from 1 to (count (get files of the_folder))
    set name of file this_file of the_folder to (name of the_folder) & " " & this_file
    end repeat
    end tell
    replacing the last this_file on the fourth line with the variable which contains the number.
    (104354)

  • Renaming files in folder

    trying to figure out how to use automator to rename files within a folder.
    searched on youtube but none of the methods seem to work on my mac.
    if anyone knows of a great tutorial for this i would love to have it.
    thanks'
    Owen

    Sorry, I'm not sure what you mean. Are you referring to the Downloads folder that Mac OS X sets up by default in your user's home directory? If so, you rename files in that folder the same as you would any other folder. The Downloads folder does not (unless something's amiss with the permissions on your system) restrict anything and isn't any sort of "special" folder in terms of how it behaves.
    If that's not what you meant, please post back and explain further.
    Regards.

  • Rename files recursively

    Hi Expert,
    I am having a hard time renaming files within subfolders, i have this script:
    Get-ChildItem  -Recurse | where {$_.name -match "^(_2014-|2014-)"} | % { rename-item $_ "_000000$($_.name)"}
    it does rename the files on the current folder but in the subfolders keeps throwing this error;
    Rename-Item : Cannot rename because item at filename  does not exist. much appreciated
    Regards

    I have upgarde to powershell 4 but none of the scripts works,
    1-  the first script there were no error msgs,  i had executed the script as it is just changed the path of the folder, 
    Set-Location -Path "C:\test"
    2- Rename-Item : Illegal characters in path.
    At C:\rename1\test.ps1:3 char:9
    +         Rename-Item $_.Fullname ('{0}\"_000000{1}' -f $_.Directory.Fullname,$_.n ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Rename-Item], ArgumentException
        + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.RenameItemComman
    Rename-Item : Illegal characters in path.
    At C:\rename1\test.ps1:3 char:9
    +         Rename-Item $_.Fullname ('{0}\"_000000{1}' -f $_.Directory.Fullname,$_.n ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Rename-Item], ArgumentException
        + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.RenameItemComman

  • Accessing a File within a zip, which was archived using Applet Tag

    Hi,
    Could Any one please tell me, How to Access a File from within an Applet. The File resides inside a zip which was Archived using <Applet> Tag.
    Actually, I want to write an application which runs both online and offline. So I have chosen Applet and All the files Which I need are zipped and is Archived through <Applet ARCHIVE="example.zip">.
    Now I want to access those XML files which are inside example.zip from my Applet.
    How can I do that?
    I think I will get security Exception.
    How to get rid of this security Exception.
    Kindly Answer soon.......
    It's very urgent.
    Thanking you,
    KumudaRaj

    Did you already try signing a jarfile? If no ->>
    You can call a class inside a jar-file within the applet.
    if this class should be able to acces files the jarfile
    first has to be signed. to do this, you must generate a key.
    the complete work:
    1. write your applet
    2. write a html-page with following code:
    <APPLET code="guestbook.class" archive="guestbook.jar" width=600 height=400></APPLET>
    3. make a zip-file with the guestbook.class, guestbook.form, guestbook$1.class, guestbook$... and rename it to guestbook.jar
    4. in the console type:
    keytool -genkey -alias YOURNAME
    5. sign the key to your jarfile with:
    jarsigner guestbook.jar YOURNAME
    6. try the applet. a warning should appear which you have to answer
    with YES then it should work
    my trouble is that i cant acces files anyway because right now i don�t
    alreadv have the clue to get the right (absolute?) path for the file. means i get an ioexception because the applet cant find the file :-((
    does anyone know how to solve this problem then? my code is:
    FileReader Stream = new FileReader("/members/Ui97u8g4f6b89mj90kh5gbr4ecf6KXC4/guestbook.txt");
    ...

  • Jar files downloaded from SkyDrive are being renamed to jar.zip files

    I have cut and pasted the following series of exchanges from when I posted the problem onto SkyDrive's support forum. I hope that someone might be able to propose a better solution to the problem that I have. Thanks for your help.
    MDSms asked on
    Uploaded jar files convert to jar.zip files when downloaded from SkyDrive
    I have uploaded an executable jar file to SkyDrive. (I will call this FILE.jar). The file is intact and indicates that it is a jar file type when the file is viewed by Properties within Skydrive. However, when I download (or others download through a share link) the file, it is being saved onto the local computer's download file with .zip appended to the file name (FILE.jar.zip). The downloaded file can be renamed to remove the .zip appendage and subsequently run successfully. However the folder options for the folder where the downloaded file resides must be changed for disable "Hide known file extensions" prior to being able to remove the .zip appendage. While I have figured out the workaround for this problem, this manual renaming procedure is entirely too cumbersome as a solution for sharing this file with others. How can I prevent or disable the FILE.jar file from being renamed to FILE.jar.zip when it is downloaded from SkyDrive?
    All Replies (5)
    Audrey_P. replied on
    Forum Moderator
    Hi,
    Thank you for posting. Let me try to assist you with your issue with your files.
    In order for us to reproduce the issue on our end. Please provide us with the exact steps that you did when you uploaded the files as well as the steps when you are downloading it.
    We will be needing the steps to help us figure put what is causing you this issue.
    We look forward to your response.
    Thank you.
    Audrey P.
    MDSms replied on
    Reply
    The file was uploaded by first logging onto my SkyDrive account using Windows 7 Pro and Firefox browser, then a new folder in my account was created without sharing privileges, then the folder was opened and the FILE.jar was uploaded into the folder using the "Upload" option on skydrive account menu. Sharing privileges for FILE.jar were then created (view only), and the shortened url link was sent to the individuals that I was trying to share the file with. was then turned on. When these people use the link to download the file, it is being saved as FILE.jar.zip.
    When I try to download the file through the skydrive account download option, it is being saved onto my computer as FILE.jar.zip and this occurs when I try to download the file while signed into my skydrive account as well as when I am not signed into my skydrive account (using the shared file link).
    This PNG shows the information provided by clicking on the download icon (down arrow) within the Firefox browser; note that the file was downloaded as FILE.jar.zip and that the source was live.com. When I use Windows Explorer to look at the same file within the Download folder itself, examining the file's properties details also shows that it is being saved as FILE.jar.zip and is of the file type compressed zip folder.
    This PNG shows the information displayed to me from my skydrive account when I view the originally uploaded file's properties; note that the information shows that the file is a jar file type.
    When I utilize Internet Explorer 9 to access the file, FILE.jar is being downloaded onto my computer as a jar file type. This PNG shows the information provided by Tools/View Downloads within the IE9 browser. Note that in this instance, the information indicates that the file is being downloaded from yzudea.blu.livefilestore.com.
    It appears to me that the problem (the FILE.jar file being renamed to FILE.jar.zip) arises from the fact that a jar file downloaded from skydrive using firefox, is being sent from live.com whereas a jar file downloaded from skydrive using IE9 is being sent from yzudea.blu.livefilestore.com.
    I want to make sure that a person receiving a share link from me for FILE.jar is able to download it without modification to the file name regardless of which browser is being using to access the link. How can I make sure that this occurs?
    Any help is appreciated. Thanks.
    Michelle Anne D. replied on
    Forum Moderator Community Star Community Star
    Reply
    Hi MDSms,
    I appreciate you for providing as much information as you can about the issue, as well as for uploading screenshots on what you see from the downloaded file. About your initial concern wherein the file gets renamed with .zip after the original file extension, this is solely dependent on the browser that you are using since they have a different safety/security measure that needs to be implemented.
    Moreover, you may see the file servers live.com and yzudea.blu.livefilestore.com to be different with one another, but they actually are sent from the same SkyDrive server. This in turn, depends on the web browser where the file is being downloaded as well. The live.com file where it was downloaded from Firefox simply masks its original server yzudea.blu.livefilestore.com.
    As for your last query about your recipients downloading the file without the hassle of renaming it from a .zip file, you can simply tell them to download it through Internet Explorer.
    Should you have other queries or additional information that might help in our investigation, I highly encourage you to post them here.
    Regards,
    Michelle
    MDSms replied on
    Michelle,
    Thanks for your reply. Yes, I could simply tell them to download the file through Internet Explorer, but is there another solution or workaround to the problem I have described here? Am I being punished with the curse of this problem simply because I (or the individuals with which I wish to share FILE.jar with) choose to use Firefox instead of IE? Will the use of any other browser instead of IE (Chrome, Safari, etc., etc.) still result in the same problem?
    You stated that it is "solely dependent on the browser that you are using since they have a different safety/security measure that needs to be implemented"........could the problem be overcome by designating one or both of the file server addresses as Trusted Sites within the browser options setting?
    I look forward to your response. Thanks in advance.
    Joy V. replied on
    Forum Moderator Community Star Community Star
    Reply
    Hi MDSms,
    We understand your concern. Since the issue does not occur in Internet Explorer, it has something to do with Firefox's security feature. You might want to verify this concern by contacting Firefox support.
    Hope this helps. Let us know if we can further assist you with SkyDrive.
    Thanks,
    Melanie Joy

    Try to delete the mimeTypes.rdf file in the Firefox profile folder to reset all file actions.
    *http://kb.mozillazine.org/mimeTypes.rdf
    *http://kb.mozillazine.org/File_types_and_download_actions#Resetting_download_actions

  • To ZIP all files into a single ZIP archive

    hi,
    Can anybody suggest me how to Zip mutiple files into single Zip archive.

    Hi,
    use Winzip :).Or jar all your files with JAVA. And then rename the
    extension to .zip. In fact a .jar file is a .zip file.
    http://java.sun.com/docs/books/tutorial/jar/basics/index.html
    Cheers!

  • Can't figure out why the "Do this automatically for files like this from now on" is disabled Compressed (zipped) Folders

    I recently had to uninstall and reinstall Firefox. Now with the new version it will not allow me to click the check box "Do this automatically for files like this from now on". The line is disabled and a light gray. I went into the Applications tab under options and can't find the Compressed (zipped) Folders file type either.
    I download a bunch of files for work and to have to click is going to be the biggest pain. Any help will be greatly appreciated!!

    Screenshot:

Maybe you are looking for

  • OIM 9.1.0.1 installation issue in weblogic

    OIM:9.1.0.1,DB:11g and weblogic 10.3.2 on linux 5.3 32 bit After installtion not able to find xlwebapp in admin console. When I search xlwebapp in /u01 oracle@oim ~]$ find /u01 -name xl*.war -print /u01/app/oimserver/xellerate/webapp/xlScheduler.war

  • Space in the Table Name

    I was writing a program to move data from an Access database on to a different database. The existing access data base has table names with spaces and SQL queries do not recognize such names! Any suggestions?

  • Lightroom 2 Manual in PDF format

    Where can one find the LR 2 User Manual in PDF format? Y=The help screen mentions it is available on line, but I have looked everywhere I could think of and nada. Any help would be greatly appreciated, TIA, John

  • Compiling JSP files

    Hi, I want to work JSP files with the help of Eclipse. I had the plugin for Tomcat also, all i need is the process of where to store the JSP files and how to compile them with eclipse.

  • Does any one develop jsr-168 portlets (jsd portlets) using Jdeveloper ?

    hi Thank you for reading my post Does any one uses Jdeveloper to build jsr-168 compliant jsf portlets? does ADF faces works inside a jsf component or not ? Thank you very much