ZIP Function - Need Additional Controls To Mitigate Occasional Looping

I have an extremely large volume of files that need to be individually ZIPed (in blocks of 200-400k files).  While using the function below, sometimes the file does not get added to the ZIP file (initialized/created as part of 'new-object') and the
function gets stuck in an infinite loop checking for the pre-created ZIP file to grow in size greater than its initialized size of 24 bytes.  All files I'm compressing are less than 200-300k in size and compress immediately.  If the addition to the
ZIP file takes longer than 50ms, I see an error pop up once and then it moves onto the next file because the second check for file growth becomes true and the file add has successfully completed.
Personally I just would like to add a counter that checks to see how many times the while statement gets executed so that after 5-10 times, it re-issues the the command to add the file to the zipfile (which appears to resolve the issue when executed manually
from a seperate powershell window).
One option that came to mind was to wrap line for adding the file (into the ZIP file) into the while clause and then try to incorporate the counter in there.  I just haven't tried it yet.
Any additional thoughts on how to accomplish the above modification (to the script below) would be appreciated as my biggest issue is the inability to re-create the problem at-will.  
function zipit { 
  Param([string]$path) 
  if (-not $path.EndsWith('.zip')) {$path += '.zip'} 
  if (-not (test-path $path)) { 
    set-content $path ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18)) 
  $ZipFile = (new-object -com shell.application).NameSpace($path) 
  $input | foreach {$zipfile.CopyHere($_.fullname); while ((Get-Item $path).length -le 25) {Start-Sleep -m 50}}
Any help is much appreciated.
- Rob

Thanks to all for the input.  
If I understand JRV's first comment, it's in relation to using the 'CopyHere' method and the fact without auditing for file completion (i.e. if not exists clause), it was cumbersome to use and slowed down by needing to 'sleep' the script between checks for
existance to prevent excessive CPU utilization by the job along with it being an ASYNC call with no guarentee that your file would be compressed properly without the aforementioned compensating controls.  My personal experience with this method is that
it seems to work, just not consistent when being called repeatedly (i.e. script compressing 200k files individually).  We ended up with the script getting stuck in a loop once and a while if the file didn't get added to the pre-created ZIP file.  This
was the leading reason why I continued to explore other methods as this inconsistency meant 'babysitting' our conversion process more.
I went with what I found (related to .NET Framework 4.5 ZIP functionality) as the implementation was very easy to just re-use and script against (which is effectively what Mike said to use).
The speed improvement in our case with leveraging the .NET Framework 4.5 ZIP functionality was welcomed as its performance is 4x that of using the less desirable 'CopyHere' method.  Its synchronous nature of .NET 4.5 call  also meant not putting
the script to sleep for 50ms at a time regardless if it was necesssary or not which I'm sure was also part of the boost in throughput.
- Rob

Similar Messages

  • Do I need additional hardware to control solenoids?

    Currently we have an NI MID 7602 motor drive and a SCB-68 connector block connected to an NI PXI-7334 motion controller. I need to control several solenoid valves. I have never dealt with solenoids before, so do I need additional NI hardware to be able to control these solenoid valves? My professor and I assumed that we could use the digital I/O interface (through the SCB-68) to control the solenoids, but I have a feeling a vital component is required.

    And as KC mentioned you will, in most instances, want a diode connected across the each of the DIO driven relay coils. This diode is connected so that it does not conduct when the coil is driven. It is there because the collapsing magnetic field of the coil, when it is de-energized, can induce surpisingly large voltages back into the driving circuit, in the same manner that the spark coil in an automobile ignition system works and the diode effectively shorts this reverse emf.
    P.M.
    Message Edited by LV_Pro on 10-17-2005 03:39 PM
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Adding additional controls in container top

    I'm customizing the OrderEntry project which I've already completed the basic functionality. In the container top I'd like to add additional controls besides add delete record which is already there. Does anybody know which file(s) do I need to edit in order to add additional controls in the container top?
    TIA,
    Alan

    Alan,
    Assuming you are talking about customizing a JSP you have generated...
    I suggest you take a look at the data web beans, which are pre-defined controls you can add to your JSP.
    Information about customizing a JSP (including adding data web beans) is in the online documentation, under:
    Developing applications
    -> Developing Web Applications
    -> Using JavaServer Pages
    -> Customizing a JSP application
    Blaise

  • Does Symantec Endpoint need additional Malware protection?

    I have been approached by a tech company that helps me monitor our systems and they are telling me that I need to ADD Malware Bytes Subscription to my network.  Symantec says that they already handle malware detection, etc.  BUT this other company is telling me I need additional coverage. 
    My question is: How many layers do we need?  Is it industry standard to have both??
    This topic first appeared in the Spiceworks Community

    I had some problems with Norton version 10, but none whatsoever with version 11. I've also used VirusBarrier X6.
    VirusBarrier is very configurable but on can give some false warnings if you set it to watch network traffic, monitor for virus-like activities, etc (like it thought Data Rescue was acting suspiciously). VB has warned me about a compromised web page I visited, so that feature works. I've never had a false alert from Norton but  neither has ever found an actual Mac virus so I have no experience with that (NAV has found Windows viruses in attachments, and a Word macro virus).
    If you don't want to configure anything and don't want false alerts use NAV. If you want more configuration options such as monitoring Internet port connections, web threats, etc. and don't mind dismissing an occasional false alarm the VB is a good choice.
    NAV has never slowed anything down. VB usually is transparent but on rare occasion one of the subprograms has run wild (virusbarrierd or virusbarrierb) forcing me to either kill it or restart my computer.

  • 10.9.4: Graphical errors when using OSX functions like Mission Control, Spotlight

    Device: MBP 15" Retina 2.3 GHz Intel i7
    OSX: 10.9.4
    Monitor: 27" Thunderbolt Display
    Issue: When using OSX functions like Mission Control (Expose) and spotlight, I frequently get graphical errors that remain on the desktop unless I reset the computer. I can resolve the issue by adding a new desktop and dragging my windows over.
    This happens almost every day.

    You have installed all these non-Apple system modifications:
    Kernel Extensions: ?
      [loaded] at.obdev.nke.LittleSnitch (4052 - SDK 10.8) Support
      [loaded] com.nvidia.CUDA (1.1.0) Support
      [loaded] com.promise.driver.stex (5.2.7 - SDK 10.9) Support
      [not loaded] com.silabs.driver.CP210xVCPDriver (3.0.0d1) Support
      [not loaded] com.silabs.driver.CP210xVCPDriver64 (3.0.0d1) Support
      [not loaded] com.wacom.kext.pentablet (5.2.6) Support
      [not loaded] com.wacom.kext.wacomtablet (6.3.8 - SDK 10.9) Support
    Litlle snitch has been a bad actor for some users.
    You do not have any CUDA Hardware, so the CUDA Driver is not needed.
    I do not know what siLabs driver thinks it may be driving.
    You left the door open:
    Gatekeeper: ?
      Anywhere

  • I need to control which software gets access to the the internet

    Hello,
    I need to control which software gets access to the the internet to control my GPRS bill. For example, I want only Battle.net software (Blizzard Armory) to be able to access the internet when I leave my home or work WiFi and hit the road where I connect through GPRS and/or 3G. Is there such a software that does this function?

    No, it's all or nothing.

  • Need Additional Software

    When I receive some video files in my email and I go to play them, it says that I need additional software because Quicktime cannot play the attachment. I have included the actual "error" message.
    The movie is not in a format that QuickTime Player understands.You may need to install additional software to open this type of file.
    Not sure what else to install.

    As you are running a very old version of OS 10.3 it is difficult to answer your question, simply because the various applications and add-ons you need may not work now with that old system.
    With that proviso:
    These are the downloads and the settings you need in order to view/hear/play pretty much everything that the net can throw at you: The setup described below has proved repeatedly successful on both PPC and Intel macs, but nothing in life carries a guarantee!
    Download and install (or re-install even if you already had them) the latest versions, suitable for your flavor of Mac, of:
    RealPlayer 11.1 for Mac from:
    http://www.versiontracker.com/dyn/moreinfo/macosx/15540
    Flip4Mac WMV Player from http://www.telestream.net/flip4mac-wmv/overview.htm (Windows Media Player for the Mac is no longer supported, even by Microsoft)
    Perian from http://perian.org/
    You should read this support page http://perian.org/#support in case you need to delete older codecs.
    The latest version of Adobe FlashPlayer can be obtained from here:
    http://www.adobe.com/shockwave/download/download.cgi?P1ProdVersion=ShockwaveFlash
    (You can check here: http://www.adobe.com/products/flash/about/ to see which version you should install for your Mac and OS.
    You should first uninstall any previous version of Flash Player, using the uninstaller from here (make sure you use the correct one!):
    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14157
    and also that you follow the instructions closely, such as closing ALL applications first before installing. You must also carry out a permission repair after installing anything from Adobe.
    You should also ensure that you have downloaded and installed the correct version for your Mac of Security Update 2009-001 (and for Tiger only, 2009-002 and 003). (N.B. Security Updates require both a restart and a permission repair.)
    In Macintosh HD/Library/Quicktime/ delete any files relating to DivX (Perian already has them). However it should be noted that Perian is not an internet plugin and will not play DivX files imbedded on a website. For that you will need the DivX Player browser plugin available from http://www.divx.com/divx/mac/
    Now go to Safari Preferences/Security, and tick the boxes under Web Content (all 4 of them) to enable Java.
    Lastly open Audio Midi Setup (which you will find in the Utilities Folder of your Applications Folder) and click on Audio Devices. Make sure that both Audio Input and Audio Output, under Format, are set to 44100 Hz, and that you have selected 'Built in Audio'.
    Important: Now repair permissions and restart.
    You should also consider having the free VLC Player from http://www.videolan.org/ in your armory, as this plays almost anything that DVD Player might not.
    There is an additional 'fix' you could try if you are having problems with Flash and Quicktime, depending on which type of Mac you have:
    On Intel Macs, make sure that you are not running Safari in Rosetta. You can check this, and change it, in the Get Info window.
    On PPC Macs, go to the Hard Disk/Library/Internet Plug-Ins folder, and drag the file 'QuickTime Plugin.webplugin' to the desktop. Quit and restart Safari. If things have improved you can trash that file. If they haven't put it back, as the lack of this plug-in can cause QT content in some widgets to cease functioning.
    And there is an additional kid on the block: SilverLight. Microsoft has created their own version of what a replacement for Flash could be. You can read more about it here:
    http://silverlight.net/
    So, if you go to any sites that have been designed for this new Silverlight stuff, you can download the plug-in from here (but make certain that you are downloading SilverLight v.1.0 for OS X (10.4.8 upwards) if you are using a PPC Mac, but even this will not work with Safari 4. Version 2 only works with Intel Macs and does work with Safari 4:
    http://silverlight.net/GetStarted/
    Recommendation: Close all applications before installing any of the above, repair permissions, reboot, and repair permissions again.

  • 5. We need additional time to process your transaction You should get an email from us by next business day. If you don't hear back from us, you can check your order status on your account page or call us at +1 800-585-0774. If you're not in North America

    Step 5.
    5. We need additional time to process your transaction You should get an email from us by next business day. If you don't hear back from us, you can check your order status on your account page or call us at +1 800-585-0774. If you're not in North America, you can look up a local number here. For now, check out all the great free features of Creative Cloud! Get started with trials
    I keep getting this.
    The Bank and Paypal states that Adobe needs to process my transaction twice.
    I have no order number/ no status nor contact from Adobe. I called customer service and he transferred me to sales where the phone rang with no answer.

    Since this is an open forum, not Adobe support... you need to contact Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"
    -or by telephone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • Need Volume Control API's for windows phone 8.1

    Hi,
       I'm developing a windows phone 8.1 app in which volume need to control. To do this I'm not getting API's to perform this operation, so can any one help to develop this app. if not please post some suggestions why this is not possible.
    Thanks in advance.
    Regards,
    Naresh Kumar

    Hi NareshKumar,
    Volume control always needed by play some media stuff, could you please tell us why and where do you need the volume control.
    Basically as I know if we play the sound by MediaElement, it has a
    Volume property, or what kind of media play control are you using?
    Indeed, there is no API that can directly control the system volume, only user can manage that.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • HT1725 When I type in my apple ID to download a song it says it needs additional info for security, and then it asks me two questions that I don't know the answers to. What do I do?

    When I type in my apple ID password to download a song it says it needs additional information so I clicked ok. And then it asked me two security questions that I don't remember the answers to. What do I do? I'm so frustrated

    Forgotten Security Questions/Answers
    You need to contact Apple by:
    1 - Use the Express lane and start here:
    https://expresslane.apple.com
    then click More Products and Services>Apple ID>Other Apple ID Topics>Forgotten Apple ID security questions.
    or
    Apple - Support -form iTunes Store - Contact Us
    2 - Call Apple in your country by getting the number from here:
    http://support.apple.com/kb/HE57
    or           
    Apple ID: Contacting Apple for help with Apple ID account security
    3 - Use your rescue email address if you set one up
    Rescue email address and how to reset Apple ID security questions
    For general  information see:
    Apple ID: All about Apple ID security questions

  • I have a macbook air and need additional storage should i consider a time capsule or a simple external hard drive?

    I have a macbook air and need additional storage should i consider a time capsule or a simple external hard drive?

    If you move live files (files you don't want to lose) to an external drive, you need to back them up.  Any files not backed up are at risk of loss.  Hard drives and SSDs can fail at any time.  It is hard to backup a Time Capsule so a TC should be used only as a backup device.
    Do you have a Time Machine backup now?  If so, and if it is large enough, you can backup your internal and external disk to it using Time Machine.  If not, you all need to purchase an external drive or TC as your backup device.  (I recommend an external hard drive for backup instead of a TC.)  Ideally the backup drive should be twice the size of what you are backing up but 50% larger will work so if you have an external 1 TB disk and an internal 250 GB SSD then a 2 TB backup disk will work well.
    By default, Time Machine will not backup the external disk.  You need to remove it from the exclusions list:
    To have Time Machine backup your system disk and your external offload disk up onto your Time Machine disk:
     > System Preferences > Time Machine > Options… > Remove the offload HD name from the exclusions list.

  • I have Mac OS X 10.5.8 on mid-2009 Macbook Pro (683MB RAM used, 81.67GB free space), do I need additional RAM to update to Snow Leopard?

    I have Mac OS X 10.5.8 on mid-2009 Macbook Pro (683MB RAM used, 81.67GB free space), do I need additional RAM to update to Snow Leopard?
    I was told I can update to Snow Leopard without adding RAM but just read on another discussion thread that someone with the same age Macbook Pro that I have was told to purchase more RAM then update to SL.
    Serial # W8*******6D
    Model Identifier: MacBookPro 5,5

    Thanks!
    I ordered 4 GB from crucial.com, product info below. Do you know if it will be 1 or 2 sticks? If only 1, will I be able to use the original 2 GB installed in the machine and the 4 GB from crucial.com?
    Part Number: CT4G3S1067M
    Module Size: 4GB
    Package: 204-pin SODIMM
    Feature: DDR3 PC3-8500
    Specs: DDR3 PC3-8500 • CL=7 • Unbuffered • NON-ECC • DDR3-1066 • 1.35V • 512Meg x 64 • lead free • halogen free • for Mac

  • JMS Content Conversion - Need to control RecordSet per Message

    Hi All,
    I have done a simple JMS to JMS scenario with content conversion.
    I need to control  RecordSet per Message ( similarlly we do for the FILE . that is , Recordset Structure = Records, 500 and Recordset per message = 1)
    How to achive this in JMS adapter.
    Regards,
    B.Jude

    There doesnt seem to be an option for that in the messagetransforbean
    http://wiki.sdn.sap.com/wiki/display/XI/HowTo...ContentconversionmodulewithJ2EEJMS+adapter

  • I need a control which allows a user to choose from specific values (which I specify), NOT 0, 1, 2 etc. [I KNOW I can let him enter 0, 1,2 fro

    m a listbox, and then change the value on the block diagram, but what I want is that on the subvi node itself he can enter the actual values, say 1, 10, 200. Does anyone know how to do this, creatively, since currently a control like this is not available.I need a control in Labview which allows a user to choose from specific values (which I specify), NOT 0, 1, 2 etc. [I KNOW I can let him enter 0, 1,2 from a listbox, and then change the value on the block diagram, but what I want is that on the subvi node itself he can enter the actual values, say 1, 10, 200. Does anyone know how to do this, creatively, since currently a con
    trol like this is not available.

    m a listbox, and then change the value on the block diagram, but what I want is that on the subvi node itself he can enter the actual values, say 1, 10, 200. Does anyone know how to do this, creatively, since currently a control like this is not available.> I need a control which allows a user to choose from specific values
    > (which I specify), NOT 0, 1, 2 etc. [I KNOW I can let him enter 0, 1,2
    > from a listbox, and then change the value on the block diagram, but
    > what I want is that on the subvi node itself he can enter the actual
    > values, say 1, 10, 200. Does anyone know how to do this, creatively,
    > since currently a control like this is not available.
    >
    One way of doing this is to use either a ring or enum where the strings
    presented to the user are "1", "10", or whatever you like. On the
    diagram, the values will be 0, 1, 2, in a compact counting sequence.
    Then do an array index into a constant. If this is done more than one
    place, make the control a typedef so you can keep them consistent an
    d
    make the index be done in a subVI. Then whenever you need this, you
    drop the control and the subVI, out comes the integer, float, or
    whatever it is you want to index.
    Greg McKaskle

  • I want to open a radio file that is .rm.  I get a message that says I need additional Quicktime software, but I cannot locate what I need to download on the QT website.  Anyone got ideas about how I can open this file?

    I want to open a radio file that is .rm.  I get a message that says I need additional Quicktime software, but I cannot locate what I need to download on the QT website.  Anyone got ideas about how I can open this file?

    Hi bert,
    the ".rm" extension is created by 'Real Media' application.
    The easiest way to use it is to install the 'Real Media' player:
    1. RealPlayer BBC.app
    2. RealPlayer 12.app
    I have both installed & use them sometimes.
    (The 'BBC' wersion doesn't have any adverts with-in the app.)

Maybe you are looking for

  • Conversion configuration error Unknown structure Header found in document

    Hi, we are having the following target structure according to that we need to generate a file. Output file sample format: ACODESXXXX0001581012011-03-2209.12.42WARRANTY CAUSE CODES FILE ACODESXXXX000158102CCCORROSION INSPECTION ACODESXXXX00015810255CA

  • PAL or NTSC for international distribution?

    Hi everybody, we have a 5 hrs film shot and edited in Premiere Pro CS6 in HD pal, 50fps, 16:9  intended for international distribution on 2 double layer DVDs. How should we best author it to guarantee worldwide compatibility and best possible quality

  • Tips for new iphone 5 owner

    After months of..... 'subtle hints'... i have ordered the 5 for her ladyship and myself. I have never owned an iphone (yes, i know...) and was looking for any sensible tips regarding ownership.........  accessories, apps, software, usage etc Regards

  • Encore CS6 Crashing on MacPro

    I have installed Adobe CC 2014 and have been using Encore CS6 which I installed via the instructions here Encore CS6 not installed with Creative Cloud. Unfortunately, Encore has been crashing about 3/4 of the time I open it and I'm not sure what the

  • Download Premiere Elements Error 1935

    I have succesfully downloaded Elements 11 off a purchased disc, but cannot download Premier elements 11 off same disc. I keep getting error 1935. Can anyone advise?