Broken: PS script to recursively zips files into one zip file

Hi
I'd like a script which zips all files and subfolders older than a specified date.
I've have spent a fair bit of time hacking with no luck.
I'd greatly appreciate any help.
AJ
PS. This script seems to do the trick -
 $folder = "C:\temp2\" 
 $zipFileName = "C:\temp\test3.zip" 
 $zip_date = Get-Date "6/5/2014"
 set-content $zipFileName ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18)) 
 $ZipFile = (new-object -com shell.application).NameSpace($zipFileName) 
 Get-ChildItem $folder | foreach {$zipFile.CopyHere($_.fullname)} 
However, when I enter where clause  only the top folder is zipped?
Get-ChildItem $folder| Where-Object { $_.LastWriteTime -lt $zip_date }  | foreach {$zipFile.CopyHere($_.fullname)} 
AJ
Ps. I'm using script from http://stackoverflow.com/questions/5641162/compress-files-in-folder-to-zip-file-by-using-ps

Hi Rapido2,
Thanks for your sharing =)

Similar Messages

  • Windows batch script to recursively copy file/directory of a specific patern

    I would like to copy all pdf files from  directory 'src' and sub-directories 'src/src-sub1' to directory 'trgt', including the directory structure. Any suggestion? thanks!

    Hi,
    Run the command below:
    robocopy x:\src x:\trgt *.pdf /s
    How to write a batch file:
    http://www.wikihow.com/Write-a-Batch-File
    Andy Altmann
    TechNet Community Support

  • How to zip multi files into one zip file in ABAP

    hi all:
    As you know, ABAP has CL_ABAP_GZIP class to support zip file function. But it only support one file zip. If I want to zip two files into one zip file, how to do it?
    thanks.

    Hi,
    <li>If you know how to zip one file,  to zip two files , you can follow the below steps.
    DATA:g_zipper     TYPE REF TO cl_abap_zip.
    "create our zipper object
    CREATE OBJECT g_zipper.
    "add 1st file to zip
    CALL METHOD g_zipper->add
       EXPORTING
         name    = file_name
         content = content_x.
      "add 2nd file to zip
    CALL METHOD g_zipper->add
       EXPORTING
         name    = file_name
         content = content_y.
    "save zip
    CALL METHOD g_zipper->save
       RECEIVING
         zip = zip.
    Thanks
    Venkat.O

  • I need a script that copies the filename into the file

    I need a script that copies the filename into 4th column of each line in the text doc file.
    I have over 2000 different file names each containing 6 columns and ~50-100 rows.
    I can do this manually using this script:
    awk '{print $1"\t"$2"t\"$3"\t <name> \t"$6}'
    But I would like an automation command or script. Is there any command that I can use instead of <name> that will copy the filename into the column?
    Thanks
    Monica

    Oops, I forgot the redirect to a file. It's not a good idea to edit files in place. A script could fail and you're left with at least one file ruined. It's better to create new files then delete the old files.
    for file in *; do
        while read col1 col2 col3 col4 col5 col6; do              
            printf "%s\t%s\t%s\t%s\t%s\n" $col1 $col2 $col3 $file $col6
        done < $file > n$file
    done
    You could narrow the files listed such as
    for file in *.tsv
    and redirect the new files to another directory. Such as
    done < $file > /absolute/path/to/directory/$file

  • Script to import a file into AE

    Hi there,
    I am looking into how to write a script that allows me to import a file.
    I have created a camera rig a few months which I now usually manually import (just import the AEP into my project)
    But I would like to have a script that allows me to have the AEP located in th AE scripts folder, together with the scipt and will let me import it by just running the script. (just to be clean, I don't mean expressions, I mean a javascript file that imports a certain file to my project)
    I don't really know much about scripting and can't find a solution anywhere.
    If anyone can help that would be greatly appreciated.

    Here is the code.Run it and choose your project file,then AE will import it for test and show a window with final text,which is what you want.Copy the text ,create a *.jsx,and you can run it whenever you like.By the way, if you want AE to run the script automatically when open AE  ,try to copy the script to the Folder ("After Effects Path\Support Files\Scripts\Startup");
    function importProject(file) {
        if (file != null) {
            var f = new ImportOptions();
            f.file = file;
            f.forceAlphabetical = false;
            f.importAs = ImportAsType.PROJECT;
            f.sequence = false;
            if (f.canImportAs(ImportAsType.PROJECT)) {
                try{f = app.project.importFile(f);
            w = new Window("palette");
            text = w.add("EditText{properties:{multiline:true,scrolling: false},preferredSize:[180,300],text:'',enabled:1}");
            text.text = "function importProject(file) {"+ "\r" +
    "    if (file != null) {"+ "\r" +
    "        var f = new ImportOptions();"+"\r" +
    "        f.file = file;"+"\r" +
    "        f.forceAlphabetical = false;"+"\r" +
    "        f.importAs = ImportAsType.PROJECT;"+"\r" +
    "        f.sequence = false;"+"\r" +
    "        if (f.canImportAs(ImportAsType.PROJECT)) {"+"\r" +
    "            f = app.project.importFile(f);"+"\r" +
    "        }"+"\r" +
    "    }"+"\r" +
    "}"+"\r" +
    "importProject(File(\"" +file.toString() +"\"));"+"\r" +
            w.show();
            }catch(err){alert(err);}
    importProject(File.openDialog("Please select the project file.", "*.aep", false));

  • I would like to get only specific channels from several .csv files and concatenate into one group.

    Hello,
    I am working with other groups and getting the data in daily .csv files.  When I use the "concatenate groups" script along with a script on importing files, I end up getting a huge file that takes about an hour to concatenate.  In order to reduce the amount of time and memory that this takes, I was hoping that someone could help me modify the script so that I could just list the channel name that I am interested in and concatinating only those channels rather than all of them. 
    For example, if voltage, temperature, pressure and time data are taken daily for 30 days, I would like to import only the temperature and time data (from .csv format) and concatenate into one group.
    I have attached the .vbs files that I use.
    Thanks in advance,
    Alan
    Attachments:
    Import and concatenate files.zip ‏9 KB

    Hi Alan,
    Actually, the feature you're asking for is already in the code of mine that you sent back. Look on line 11 of the main VBScript:    ChannelSet = "" ' "" or "1-" (DataPlugin) or "Sheet1" (EXCEL Wizard) 
    If this "ChannelSet" parameter is set to something other than "" or "1-" then it is used in line 78:
    Call DataFileLoadSel(FilePaths(i), DataPlugin, ChannelSet) 
    Yo can specify the channel indices to load with an expression like this:
    ChannelSet = "[1]/[1],[3]" 
    Let me know if you have further questions,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • I received pictures in a dozen emails and saved each picture into one file in .pages.  I did not import the photos before doing this and now iPhoto won't recognize the pictures because they are in a .pages file.  How do I get the pics to iPhoto?

    I received a dozen pictures in a few emails and I saved them all into one file in pages.  I just copied and pasted.  I do not have the originals any longer.  Iphoto will not permit me to import the pictures as it does not recognize a .pages file, nor can I simply click and drag from the pages document to iphoto nor from pages to the desktop to iphoto.  How can I save each picture I guess back into a jpeg and then import them into iphoto or have i lost them to a pages document forever?  This is urgent as I need the pictures made into a book on iphoto for work by Friday!!!  Please advise!  Thank you.

    Greetings,
    Locate the Pages document wherever it's located on your computer and click once on it to highlight it.
    Go to File > Duplicate to make a backup copy of the file.
    Click once again on the file to highlight it.
    Go to File >  Get Info
    In the "Name & Extension" category remove the ".pages" extension and put in ".zip".
    Close the info window and double-click the now renamed pages file (zip file now).It will decompress into a folder which contains all the base components including all the images you added.  These can be dragged onto the iPhoto icon to import them.
    Hope that helps.

  • How do I add multiple images into one file?

    I'm sure this is something that's been covered in another post (or even in the help portal) but I think my wording in my search terms are not correct or... I don't know, because I just can't find what I'm looking for.
    I want to know how to add multiple images into one file/one image, both horizontally and/or vertically. To give you an idea of what I mean, check out :
    http://www.best10apps.com/apps/comic-story,531596060.html
    If you scroll down, you'll see a heading entitled : Screenshots of Comic Story. Notice how there's 3 pictures (divided by borders). 2 of those pictures are side by side, and 1 of them is below the first 2 pictures.
    I want to know how to add different pictures/images and put them into one picture.

    One way is to create template PSD files and populate them with your images using Photoshops scripts.
    Photo Collage Toolkit UPDATED June 12, added Picture Package Support via PasteImageRoll and BatchPicturePackage scripts.
    The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.
    There are eleven scripts in this package they provide the following functions:
    TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
    CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
    LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
    InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
    ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
    ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
    PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
    BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
    BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
    BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder
    PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
    Documentation and Examples

  • Joining multiple inDesign files into one, can you solve this?

    OK so basically I work at a magazine, the creative's all work on separate spreads so all the inDesign files consist of between 1 and 10 pages then usually they are all spat out in there sets of PDF's and sent to the printers.
    Now I want to do an online addition of the magazine with the new SWF export feature in inDesign CS4 but I'm wondering how can you easily compile all of the separate inDesign files into one so that it can spit out one single swf with all 200 pages with the page peel effect?
    Is there even a way without a mass of work of manually adding all the pages into one file, that would be absolutely humongous? Anyone with any suggestions how to make this process the simplist and with the least amount of labout would be an absoulute legend, I have little time to spend on this which sucks so looking for the best and fastest possible way that we could do it each month.
    Cheers
    J

    I migth have a kind of solution for you. I have made a solution named eDocBrowser. (I called it Magazine Browser in earlier threads here and couple of other forums). It´s a collection of files that you publish with you SWF-files you have exported from InDesign. With eDocBrowser, you can put several SWF-files together and end-user can use them almost as one single SWF. Heres little demo I made just few minutes ago.
    http://www.prepress.fi/eDocBrowser/
    There are 3 SWF-files, all of them exported from InDesign. They are originally separate indd-files. When you reach last page of Document1, small arrow appears, and text "Jump to next file" and name of the next file too. You can go there also by using next-button at the bottom right corner, one that you use normaly to go next page. Same kind of arrow appears also when you are in first page of document 2 or 3 etc... with it you can go back to earlier documents last page etc... All the documents can be seen also in a drop-down menu at top of the screen. Labels of that menu are customizable.
    Theres also a zoom. When you clic zoom+ button, your cursor changes to magnifying glass. With zoom- you can go back to normal view.
    Additional features are FullScreen-view, Printing current spread and customizing user interface, buttons and logo at the top-left corner. Text search is very exprerimental and requires indd-file indexing with script we have made too. It indexes every single word in indd-document to XML-file and put pagenumbers there too. eDocBrowser searches that XML-file and gives all the hits to small result window. Hits are also links to page where they point...Search is not in use with this demo..
    There is a small help-section in top-right corner...
    We also have a script called eDocMaker. It does everything for you. You just have to have indd-files in one folder. Script asks location of that folder when you run it. It also askes you which resolution you want to use with images, anything goes between 72-2400 (72ppi is indesign´s default resolution for SWF-export, using bigger resolution might cause bigger SWF-files, but images look better when zoomed)
    Price of the single licence of eDocBrowser will be 80euros (aprx. 100dollars). With it you may install one copy of eDocBrowser into your server and use as many SWF-files there as you want. There is no search feature in single version.
    Price of unlimited licence is 300euros (aprx.400dollars) With it you may install as many copies of eDocBrowser as you like. With it you also get all the indesign scripts including eDocMaker with resolution booster, search indexer etc. + goodies like user interface and button templates, indesign effect (3D spine graphic etc)....
    Product is about ready, we are just setting up a place to sell it. Now it seems that we are going to use a service called payloadz.com....
    Additional info: petteri.paananen[at]NOSPAMprepress.fi (replace [at] with @ and remove NOSPAM)

  • How can I script a Flash .exe file to always stay on top of all other windows?

    Hi All,
    I'm new to action script, and I just need this one script
    > How can I script a Flash .exe file to always stay on top of
    all other windows?
    Basically what i want to do is have a flash-created
    step-by-step instructional movie, but for the movie to remain on
    top of all windows so the instructee is able to follow the
    instructions on-screen...
    It would be preferable to not have to buy another product
    just to do this... as I said, this is the only scripting I need.
    Thanks in advance
    Cheers
    Rick

    if you create your exe with mProjector you can use one of its
    new AS
    commands to do this.
    setZOrder
    http://www.screentime.com/software/mprojector/docs/mWin_setZOrder.htm
    all APIS
    http://www.screentime.com/software/mprojector/docs/index.html
    Demo
    http://www.screentime.com/software/mprojector/demo.html
    mProjector installs new classes and help into Flash, to
    enable them you
    must build your app with mProjector (its input is your swf)
    John Pattenden
    Screentime Media - Flash Tools since 1997
    http://www.screentime.com

  • Batch combine files into one illustrator document - how to open target document?

    I am making a script which will:
    1) Open a folder of Illustrator files
    2) Open each file in the folder (these files are called the source files)
    3) Select all the contents of the source file
    4) Copy the contents of the source file
    5) Paste these contents into a target file as a new layer
    6) Ensure the new layer has the same name as the old source file
    However, I don't know how to tell Illustrator where my target file is. How can I do this?
    Also, when I paste, how can I turn off paste rembers layers. (So the layers get pasted into the new layer that has the same name as the old document).
    Here is my code:
    // JavaScript Document
    //Set up vairaibles
    var destDoc, sourceDoc, sourceFolder;
    // Select the source folder.
    sourceFolder = Folder.selectDialog('Select the folder with Illustrator files that you want to mere into one', '~');
    // If a valid folder is selected
    if (sourceFolder != null) {
              files = new Array();
              // Get all files matching the pattern
              files = sourceFolder.getFiles();
              if (files.length > 0) {
                        // Get the destination to save the files
                        destDoc = document.selectDialog('Select the final saved document', '~');
                        for (i = 0; i < files.length; i++) {
                                  sourceDoc = app.open(files[i]); // returns the document object
                                  var myLayers = sourceDoc.layers; // All layers in Active Document
                                  //Go through all layers of source document and copy artwork
                                  for (i = 0; i < myLayers.length; i++) {
                                            myLayers[i].hasSelectedArtwork = true;
                                  with(sourceDoc) {
                                            var count = pageItems.length;
                                            for (var i = 0; i < count; i++) {
                                                      pageItems[i].selected = true;
                                            redraw();
                                            copy();
                                            for (var i = 0; i < count; i++) {
                                                      pageItems[i].selected = false;
                                  //Create a new title variable that has the title of the source document
                                  var title = sourceDoc.name;
                                  var title = title.substring(0, title.length - 4); //(remove extension from name)
                                  //Close the Source Document
                                  sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
                                  //Open the Destination Document and create a new layer in it that is named after the title variation
                                  var newLayer = destDoc.layers.add();
                                  newLayer.name = title;
                                  //Paste into this new layer
                                  destDoc = app.paste();
              else {
                        alert('No matching files found');
    Thanks in advance for any help   
    Edit: Also, when pasting, how can I paste in place instead of just pasting.

    I have been studying this script. It is similar to what I need except it places the source files (Instead of copying & pasting them)
    http://kelsocartography.com/blog/?p=204
    I have adapted the script to my needs and it works perfectly, except it has the same problem as before: It pastes the first source file, but then it endlessly starts pasting the second source file (in a loop) and so I have to force quit.
    So my new question is, when looping through files how can you get illustrator to move on the next one?
    The original kelsocartography had this line:
    thisPlacedItem = newLayer.placedItems.add()
    thisPlacedItem.file = imageList[i];
    I belive this line is what makes Illustrator move onto the next file, but I am not sure how to adapt it to my code.
    Here is my code so far:
    function getFolder() {
              return Folder.selectDialog('Please select the folder to be imported:', Folder('~'));
    function importFolderAsLayers(selectedFolder) {
              // if a folder was selected continue with action, otherwise quit
              var myDocument;
              if (selectedFolder) {
                        myDocument = app.documents.add();
                        var firstImageLayer = true;
                        var newLayer;
                        var thisPlacedItem;
                        // create document list from files in selected folder
                        var documentList = selectedFolder.getFiles();
                        for (var i = 0; i < documentList.length; i++) {
                                  // open each document in file list
                                  if (documentList[i] instanceof File) {
                                            // get the file name
                                            var fName = documentList[i].name.toLowerCase();
                                            var sourceDoc = app.open(documentList[i]); // returns the document object
                                            var myLayers = sourceDoc.layers; // Select All layers in Active Document
                                            //Go through all layers of source document and copy artwork
                                            for (i = 0; i < myLayers.length; i++) {
                                                      myLayers[i].hasSelectedArtwork = true;
                                            with(sourceDoc) {
                                                      var count = pageItems.length;
                                                      for (var i = 0; i < count; i++) {
                                                                pageItems[i].selected = true;
                                                      redraw();
                                                      copy();
                                                      for (var i = 0; i < count; i++) {
                                                                pageItems[i].selected = false;
                                            //Create a new title variable that has the title of the source document
                                            var title = sourceDoc.name;
                                            var title = title.substring(0, title.length - 4); //(remove extension from name)
                                            //Close the Source Document
                                            // check for supported file formats
                                            if ((fName.indexOf(".eps") == -1)) {
                                                      continue;
                                            } else {
                                                      if (firstImageLayer) {
                                                                newLayer = myDocument.layers[0];
                                                                firstImageLayer = false;
                                                      } else {
                                                                newLayer = myDocument.layers.add();
                                                      // Give the layer the name of the image file
                                                      newLayer.name = fName.substring(0, fName.indexOf("."));
                                                      // Place the image on the artboard
                                                      sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
                                                      //Paste into this new layer
                                                      newLayer = app.paste();
                        if (firstImageLayer) {
                                  // alert("The action has been cancelled.");
                                  // display error message if no supported documents were found in the designated folder
                                  alert("Sorry, but the designated folder does not contain any recognized image formats.\n\nPlease choose another folder.");
                                  myDocument.close();
                                  importFolderAsLayers(getFolder());
              } else {
                        // alert("The action has been cancelled.");
                        // display error message if no supported documents were found in the designated folder
                        alert("Rerun the script and choose a folder with images.");
                        //importFolderAsLayers(getFolder());
    // Start the script off
    importFolderAsLayers(getFolder());

  • Adobe Acrobat XI for mac, how to reverse pages in a pdf file and how to collate two pdf files into one

    I scanned some large documents, which were two sided. Because they were printed on glossy paper, I could not scan the pages double sided. So I made two files, one file containing all the even pages and one file containing all the odd pages. Now I have two problems: 1. the pages in the even pages file are in the reversed order, so I need to reverse the order of all the pages in this file. Then I need to combine these two files (collate) so that all the odd and even pages are combined into one single file and all the pages are in the correct order.
    In older acrobat pro programs (windows) I found a javascript file that could fix all this. However now I have Acrobat XI and I have a macbook pro, so now I'm completely lost. Can anyone help me with this problem?

    If you have a script that does it then you should use it... Open the console and run this command:
    app.getPath("app", "javascript");
    It will print out the location you need to use for the .js file you have. Then restart Acrobat and you should be good to go.

  • How to merge indesign files into one

    Hi, I have some publication as book indesign files, then I want merge these individual indesign files inside one file. I search a lot for plug-ins and scripts to do it, but nothing I dont want just PDF files, because I need edit the files after putting them together. Any tips will be valuable Regards

    Try this one: go to -
    http://kasyan.ho.com.ua/scripts_by_categories.html
    search the page until you find
    Mass combine a bunch of indd files into one by Simon Wiscombe
    hope that helps
    Colin

  • How to combine book-files into one IND-file

    Hello,
    I'm trying to make one InDesign-file from the separate files included in a book.
    I know the book option Export to PDF but what I want is something like:
    add the pages of bookfile 1 to a new document,
    then add the pages of bookfile 2 to that new document (at the end)
    then add the pages of bookfile 3 to that new document (at the end)
    until all pages of all bookfiles are combined into one document.
    I don't want to place the pages (what makes them imported pages like images).
    Is this possible? [platform Windows - Javascript]
    What I figured out (as a non-programmer) is
    to open the bookfile
    var myDocument = app.open(File("/c/Bookname.indb"), false);
    use a counter for the number of bookfiles in the book
    for( i=0; i< myDocument.bookContents.count(); i++ )
    to retrieve the name of the bookfile
    var myINDFile = myDocument.bookContents.item(i).fullName;

    Theres a Move Pages -command in Pages panels menu. With it you can move pages also between documents... may be you could use that programmatically too? Guys in InDesign Scripting forum might know better, though some of them reads this forum too....

  • How do I convert/merge multiple files (word and PDF) into one PDF?

    I have multiple word docs and PDF files that I need to merge into one file.  How do I do that?

    You should be able to do it in the image processor.
    File > Scripts > Image Processor
    If it doesn't have the options you want, then make an action using "Save for Web", then run the action on a batch of files using
    File > automate > batch
    Select your action from the dropdown menu.

Maybe you are looking for