Getting Files with batch by batch From Hard Disk

hi,
I have lakhs of xml files in my hard disk, and there is no specific pattern in the file name, I have to load the xml files in iteration by iteration. For each iteration i have to load 200 files, is there is any way to do with DirectoryInfo.GetFiles() ?
with regards
Ahamed.

Hi,
This not possible with DirectoryInfo.GetFiles(), you can do your own custom solution by filling the
whole file name into a string array and then loop over by using ArraySegment, see below:
int count = 10;//hop size
            int offset =0;
            int segmentsize = 10;
            bool stop = false;
            string[] filePaths = Directory.GetFiles(@"yourpath", "*.xml", SearchOption.TopDirectoryOnly);
            do
                if ((offset + count) > filePaths.Length)//Validate that you not running over the array index
                    count = filePaths.Length - offset;
                    stop = true;
                var segment = new ArraySegment<string>(filePaths, offset, count);
                for (int i = segment.Offset; i <= segment.Count + segment.Offset - 1; i++)
                    Console.WriteLine(segment.Array[i]);//Do your work here over the files
                offset = offset + segmentsize;//increment the offset to read the next segment size,
            } while (stop == false);
Fouad Roumieh

Similar Messages

  • Cannot delete files from hard disk (after deleting from playlists)!

    all of a sudden itunes stopped allowing me to automatically delete (with the warning) a downloaded podcast so I would have to go to the hard disk manually to delte the posdcast.
    How do I get the system back to what it was where I delete a podcast and then get the warning and say ok to delete from hard disk?
    TIA!

    Hi Chris:
    2 part response:
    I founf the problem--somehow my itunes folder was moved to a different part of my hard drive--once I moved it back I can delete.
    I can delete as follows: when I right click and click on delete, I first delete the file from itunes library--then I get prompted if I want to delete from my hard disk by sending file to recycle bin--There is also a prompt if I do not want to see the warning--which I have on as a safety precaution. So I bet the default could remove from playlist and send file to recycle bin in one move.

  • I have an old file with an .A4P video from 1999. I don't own any Adobe products (and don't really want to buy any). I just want to be able to convert the file to something that I can actually view. Any help?

    I have an old file with an .A4P video from 1999. I don't own any Adobe products (and don't really want to buy any). I just want to be able to convert the file to something that I can actually view. Any help?
    I was a kid when I made a documentary for a school project. I've been trying to figure out how to retrieve the file. 4 years ago, I was able to get the files off the Iomega Zip drive (finally), but I now see the file is saved as a .A4P. There is also a file saved as a .PKG as well, but I don't know how to open this with my Windows 8 COmputer.

    .a4p is an Authorware v.4 (Windows) project.
    Interesting you have it as a .pkg...usually that's a published-on-a- Mac extension, if I recall.
    At any rate, can you put the file up on a Box, Dropbox, FTP, etc...and send me a URL?
    I should be able to published it so you can view the project (it would be an .exe).
    It can't be converted to anything though - not without manual effort.

  • Help Editing code from a published html file with flash detection enabled from flash

    hi guys ive publish a html file with flash detection enabled from flash
    heres the code from the publish html:
    <!-- saved from url=(0013)about:internet -->
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>main</title>
    <script language="javascript"> AC_FL_RunContent = 0; </script>
    <script language="javascript"> DetectFlashVer = 0; </script>
    <script src="AC_RunActiveContent.js" language="javascript"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Revision of Flash required
    var requiredRevision = 45;
    // -->
    </script>
    </head>
    <body bgcolor="#ffffff">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <script language="JavaScript" type="text/javascript">
    <!--
    if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
         alert("This page requires AC_RunActiveContent.js.");
    } else {
         var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
         if(hasRightVersion) {  // if we've detected an acceptable version
              // embed the flash movie
              AC_FL_RunContent(
                   'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0',
                   'width', '800',
                   'height', '600',
                   'src', 'main',
                   'quality', 'high',
                   'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                   'align', 'middle',
                   'play', 'true',
                   'loop', 'true',
                   'scale', 'showall',
                   'wmode', 'window',
                   'devicefont', 'false',
                   'id', 'main',
                   'bgcolor', '#ffffff',
                   'name', 'main',
                   'menu', 'true',
                   'allowScriptAccess','sameDomain',
                   'allowFullScreen','false',
                   'movie', 'main',
                   'salign', ''
                   ); //end AC code
         } else {  // flash is too old or we can't detect the plugin
              var alternateContent = 'Alternate HTML content should be placed here.'
                   + 'This content requires the Adobe Flash Player.'
                   + '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
              document.write(alternateContent);  // insert non-flash content
    // -->
    </script>
    <noscript>
         // Provide alternate content for browsers that do not support scripting
         // or for those that have scripting disabled.
           Alternate HTML content should be placed here. This content requires the Adobe Flash Player.
           <a href="http://www.macromedia.com/go/getflash/">Get Flash</a>
    </noscript>
    </body>
    </html>
    now since the default codes places my flash movie on upper left corner, ive made my own tables with the flash on it, how or where do i place this code to the upper codes?
    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th valign="middle" scope="col"><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <th height="600" bgcolor="#333333" scope="col"><script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','wid th','800','height','600','src','main','quality','high','pluginspage','http://www.adobe.com /shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','main' ); //end AC code
    </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="800" height="600">
              <param name="movie" value="main.swf">
              <param name="quality" value="high">
              <embed src="main.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="800" height="600"></embed>
            </object></noscript></th>
          </tr>
        </table></th>
      </tr>
      <tr>
        <td height="30" bgcolor="#990000"><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <th scope="col"><table width="800" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <th scope="col"><div align="left" class="style1">Copyright 2009 St. Paul of the Cross Parish. All Rights reserved.</div></th>
                <th width="400" scope="col"><div align="right" class="style1">Usage outside our permissions guidelines requires our prior written consent.</div></th>
              </tr>
            </table></th>
          </tr>
        </table></td>
      </tr>
    </table>
    Tnx in advance!

    Hi
    Can you tell me which version of dreamweaver you are using (and flash pro, if you have it), as the code you provided has element of a number of different versions (e.g. your js flash files are reasonably new, but your flash inserted into the html body is old, but with the cs3 version of flash player indicated!). Also the detect flash file is no longer required.
    PZ

  • Can I move ninety video files with their keyword tags from 'My Catalogue' into another catalogue?

    Can I move ninety video files with their keyword tags from 'My Catalogue' into a another catalogue?

    Nyinyikay a écrit:
    Can I move ninety video files with their keyword tags from 'My Catalogue' into a another catalogue?
    Two problems :
    1 - You can't merge catalogs in PSE
    2 - The usual workaround is to 'write metadata to files', export the files and 'get' them into the other catalog. But you can't write metadata to files with video files.
    The only thing you could do would be to duplicate the catalog and delete all pictures other than your ninety videos...

  • Copy a file from hard disk to a jar

    Is there any way to copy a file from hard disk to a jar file?

    hajani wrote:
    No, I want to copy a file into an other jar file (like a zip or a rar file)
    Edited by: hajani on Dec 7, 2008 4:11 AMIf you really do mean 'jar' file an not 'zip' or 'rar' then you can use class java.util.jar.JarFile and write your own code. If you don't feel like writing a load of code then and you can guarantee that the 'jar' executable is going to be available then you could use Runtime.exec() or it's cousin ProcessBuilder. If you mean a 'zip' file then you could use class java.util.zip.ZipFile and write a load of code. If you mean a 'rar' file then you will either have to find a 'rar' class library or again use Runtime.exec().

  • Is there any way that I can get back my iPhoto?  After having hard disk replaced (no backup) and the operating system has been updated to Lion (no disc) I am wondering if iPhoto can be reinstalled with my Leopard discs?

    Is there any way that I can get back my iPhoto?  After having hard disk replaced (no backup) and the operating system has been updated to Lion (no disc) I am wondering if iPhoto can be reinstalled with my Leopard discs?

    As Niel pointed out, yes.  The disk probably will look like the MBP disk (4) in this screenshot;
    OT

  • I have file with 500 pages created from AutoCad file. In all pages, I have different document numbers.The file is not editable in pdf. How to change all the document numbers using "Comment" feature? Any alternate method?  alternate method? I have Adobe Ac

    I have pdf file with 500 pages created from AutoCad file. In all pages, I have different document numbers.The file is not editable in pdf. How to change all the document numbers using "Comment" feature? Any alternate method?  alternate method? I have Adobe Acrobat X Pro and Windows -7 platform.

    Yes, I just want to cover up all the pages for those particular area of document numbers.
    Nothing sensitive about it. I just want to show the correct document numbers on all pages in print out.
    So, I wanted to cover up by comments, but commenting on each page will be difficult. So, I wanted to comment the same on all pages.

  • Godane's Archlinux boot from hard disk but it can't login in with slim

    I download Godane's archiso-live-2009-09-24.iso , i havent cdrom , so i boot it from hard disk .
    I extract iso to drive C: (fat32) ,two folder is "boot" "archiso-live"
    my menu.lst  is :
    title Boot archiso-live Desktop
    root (hd0,0)
    find --set-root /boot/initrd.img
    kernel /boot/vmlinuz  elevator=deadline ramdisk_size=60% aufs nonfree=no vga=791
    initrd /boot/initrd.img
    load=overlay.lzm
    The iso can be boot from hd ,but there isnt slim . only is console...
    what can i do with this problem??

    I think your problem is that load=overlay.lzm is in the wrong place.
    Here is what i should look like:
    title Boot archiso-live Desktop
    root (hd0,0)
    kernel /archiso-stable/boot/vmlinuz elevator=deadline lang=en_US keyb=us load=overlay,mesa usbdelay=5 nonfree=no xdisplay=old xdriver=no from=/dev/sda3/archiso-stable changes=/dev/sda3/changes session=xfce cdname=archiso-live
    initrd /archiso-stable/boot/initrd.img
    I use 'from' boot option so i can boot from my hard drive more easier. The way its booted above is for 2009-12-08 version of my archiso-live. Just thought you should know.
    I hope this helps. And sorry for it being so late.

  • How to recovery the deleted files from hard disk like images,media files

    How to recovery the deleted files from hard disk like images, media files by using c#.net

    It's important to define deleted and recovery. You can recover file from the recycle bin using the Win API. Here's an
    example in C/C++. You need to
    pinvoke SHFileOperation.

  • How to get  data with the raw pattern from resultset ?

    would you tell me how to get data with the raw pattern from resultset ?
    thank you in advance!
    longgger2000

    I tried getBytes() and getObject()
    , but I can not get the right result , for example the
    data in oracle database is 01000000DFFF, when In used
    the method of getBytes() and getObject(), I get the
    result of [B@1c2e8a4, very different , please tell me
    why !
    thank you
    longgger2000
    [B is byte arrayseem that it return an bytes array for you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to auto insert a number array with size of 20 into a named excel file with the positon is from A1 TO A20?i use lv6.1

    can you give me a example vi for it ?thanks a lot!
    how to auto insert a number array with size of 20 into a named excel file  with the positon is from A1 TO A20?i use lv6.1

    You don't need us to give you an example, as the example already comes with LV. Go to Help>>Find Examples and search for "excel". You will find an example called "write table to XL". You should note that the example doesn't do that exactly, because it writes a 2D array from 2 to N.
    You can modify the example by using only one for loop (instead of nested loops) with a 1D array or by going into the Set Cell Value and modifying it to accept a second cell value for the Cell2 terminal and wiring in a 1D array instead of the single string. If you do modify it, be sure to save it under a different name, so you don't overwrite the original.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Noise from hard disk

    Hi, everyone.
    I bought a new mackbook pro in this Jan. Recently, I hear some not continuously noise from hard disk, especially when i open a file in hard disk or verify the hard disk. Is something wrong with my hard disk?
    Thanks

    This hard disk clicking is a know problem for many laptops. If you search it on Google, you will find a lot of discussions about it in the Unbuntu Linux forums. In most cases, it is due to the Advanced Power Management (APM) feature of notebook hard drives. The default APM settings of these drives are aggressive so as to extend notebook battery life. As a consequence, the HD tries to park its actuator head to the ramp whenever it judges the system as idle. However, OS X or some third-party applications may access the hard disk quite often, resulting in a park/unpark cycle every few seconds.
    Every of these cycles is counted as one load/unload cycle. Most notebook drives support up to 600,000 load/unload cycles. If a hard drive parks its head every few seconds, it may shorten its life by "using up" the cycles more quickly.
    I had the same problem on my Powerbook with a Hitachi Travelstar 5K160 80GB PATA drive. I heard the frequent clicking sound right after I installed it into the laptop. The SMART status appeared to be Verified, and there was no problem with the drive itself. After searching on Google and Hitachi web site, I found the causes and solved the problem using the Hitachi Feature Tool. For other HD brands, I have no experience at all.
    Basically, Travelstar 5K160 drives have three idle modes, from which a user can set one as the deepest idle state:
    1) Active Idle: the actuator head is parked near the center of the disk, and power usage is 45-55% less than performance level. Recovery time to active mode is about 20ms.
    2) Low Power Idle: this is usually the factory default idle mode. The head is UNLOADED to the ramp and the power consumption is 60-65% less than the performance level. Recovery time is about 300ms.
    3) Low RPM idle: in this idle mode, the hard disk will spin down to a lower RPM speed. More power is saved but recovery time is much longer. (I can hear the disk spin down and spin up again a few times per minute. There is also a lag in system reaction time.)
    To get rid of the hard disk clicking, you need to set Active Idle as the deepest APM idle mode. To do it on a Hitachi hard disk, you need Hitachi Feature Tool, and a Windows laptop with the same HD interface as your drive (PATA or SATA). Sadly, the feature tool is only for Windows and Linux.
    You can download Hitachi Feature Tool 2.10 as an ISO image here: http://www.hitachigst.com/hdd/support/download.htm#FeatureTool and burn it into a bootable CD. The userguide of the tool is available on the same page.
    Then, take out your hard drive from your Macbook and install it into a Windows laptop. Boot the machine using the Feature Tool bootable CD. Choose "Change Advanced Power Mode" from the drop-down menu.
    The default value is 128 (Low Power Idle). Just increase the value toward Performance, until you see the APM mode over the value bar becomes Active Idle (starting from 192). Click OK and Exit the feature tool. Switch off the Windows laptop and take out the hard disk. Install it into your Macbook. You will not hear the clicking sound again when system is idle. The lowest APM mode will be Active Idle and hence the drive will not park its head to the ramp during operions.
    If your hard drive is a Hitachi Travelstar 5K160, you can find the 5K160 specifications version 1.1 from Hitachi web site. On page 69 of the document, it explains the APM idle modes. On page 145 about the register values of the APM modes.
    To set Active Idle as the deepest idle mode may adversely affect battery life. (I haven't yet tested it myself) However, there seem not to be a big difference than the Low Power Idle, according to the datasheet of 5K160. For this model, power consumption of Active Idle is 0.8W, while that of Low Power Idle is 0.6W, on average.
    Hope this is helpful.

  • VirtualBox from hard disk, nvidia glx conflict

    Howdy folks, I recently started getting into arch linux and set it up for dual booting. Being a graphics engine developer for multiple platforms I began to work on adding support for linux.
    What I was trying to set up was so that I can use VirtualBox to load my arch install from hard disk, which I have gotten running, so that I can use virtual box to test if things work when developing simultaneously for windows, and boot over to arch for performance optimization type stuff.
    The problem I am having however is that in VirtualBox I can not get the glx extensions to load, looking at the log file it's definitely trying to load the nvidia glx extensions. My PC has an Nvidia Geforce 9600GT, so for proper support in arch I of course installed the drivers for it.
    As per suggested in the wiki I removed the xorg.conf (actually just renamed it), along with a few other files in /etc/X11/xorg.conf.d that were causing problems in virtual box (mainly the 20-nvidia.conf file). I have verified it does boot into arch with full 3D support as it did when the xorg.conf was in place. But still having the problems getting the glx extension to load when inside VirtualBox.
    I would greatly appreciate any help ya'll can provide, being able to load my arch install from virtual box would make developing this graphics engine of mine so much easier. But I still want to be able to boot into arch. Having to use a VirtualBox instance booting from a virtual hard disk is a real pain since it add to the places I need to sync up source code.

    I think you misunderstood ngoonee. Just trying to get open gl working from within virtual box, I know it's only serving as a layer over the graphics stuff.
    The problem however is that to allow gpu acceleration when I boot into it, the nvidia driver will need to remain there. But it appears the glx in the nvidia driver will not play nice with what virtual box needs.
    Idea is to use the same arch install for both virtual box and the dual boot.
    Last edited by chronosifter (2010-07-21 04:28:54)

  • Use previous "Delete from hard disk" checked state?

    Is there any way for the program to use the previous "Also delete selected item(s) from the hard disk" checked state in the file deletion confirmation dialog?  It gets tedious to check it every time I want to delete a file and if I forget to do it I will have an extra file sitting on my hard disk not in my catalog.

    A quick shortcut that I use is to hit the spacebar (checks/unchecks the "delete from
    hard disk" option), then hit the enter key to complete the process.
    Michael

  • Advice on recovery from hard disk error 301

    Hi all,
    I have a HP desktop PC, Pavilion HPE h8-1170d which is about 2.5 years+ old. The specifications are:
    Intel Core i5 2500 with 8G RAM, 1TB SATA hard disk. I have recently installed a Radeon HD6670 graphics card as the original card gave problems. I have also upgraded to a Cooler Master 500W power supply.
    Other details of my PC are listed here: http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02991104&tmp_track_link=ot_faqs/top_issues/en_u...
    Recently, I experienced failure associated with the harddisk, indicating error 301. I managed to recover sufficiently (somehow) by using Microsoft's error checking tool for harddisk and now able to boot up and run. But I know I will have to replace it as it is a matter of time before the harddisk completely dies.
    Before I go and buy a replacement harddisk, I hope I could know about the following:
    1. I am not sure which version of SATA is my PC using. Can I just specify that I want a SATA harddisk, and not be concerned about their version of SATA ? 
    2. What is the best way to replace the harddisk from the software perspective ? Should I do an image copy from my current harddisk, if so, what is the easiest way to do this ? sorry, I have not done this before so need to ask such basic question. Would it make sense to connect the new harddisk first and then do the image ? 
    Thank you very much for any help !
    smtan
    This question was solved.
    View Solution.

    Hi smtan,
    A SATA III, 6 GB data transfer rate disk will work.
    Your PC model was introduced by HP in 2011. It may have SATA II but a SATA III disk will be backwards compatible. If this is true you will be limited to 3 GB transfer rates.
    One other consideration is HDD size. You should probably limit the HDD replacement size to 2 TB. Your PC probably has a legacy BIOS and your HP Recovery discs may not work on a HDD exceeding 2 TB.
    You have a couple of choices on moving or installing Win 7 on your new HDD.
    You can clone the existing install from the original HDD to the replacement HDD. You will need to use either: free disk imaging software or purchase this software. I have heard good things about Macrium Reflect free and EaseUS free.
    You can GOOGLE for other choices.
    Install the disk imaging/cloning software on the source HDD. Install the new HDD in your PC.
    Run the cloning software and follow instructions on cloning the operating system to the new HDD.
    Please see this article for instructions on cloning one HDD to another.
    This article may interest you. Consider purchasing an SSD replacement drive. The performance increase is unbelievable. Many SSD manufacturers provide cloning software with the purchase. You also need to buy the desktop kit version. This includes a 3.5 inch adapter for installing the 2.5 inch SSD in the HDD cage.
    There is a downside if you go SSD. Your HP recovery discs may not work because the replacement SSD will be less than 1 TB. There are ways around this. Please see this forum post on installing Win 7 without a disc. Let me know if you are interested.
    Jaco
    ****I am not an HP employee****
    Please give a" Kudos, Thumbs Up" if advice received is relevant or" Accept as Solution" to assist other forum users having a similar problem.
    HP Products:
    810-150se Desktop
    17t-j000 Notebook
    H8 1380t CTO Desktop
    560z Desktop
    Errare humanum est.

Maybe you are looking for