C# search c drive for pacific string

im making a program that will search for a folder in c drive and i want to make it so if it exists then it will delete the folder and its content also want to have a button that is false if files are found with that name then it will enable the button for
you to delete the files found im slowly working on getting this program to remove unwanted files like pop ups and malishias browser take downs ect so thats why i want to try and make it :) 
thanks in advance :) 

Hello Elfenlied...
This is the VB forum, I've marked your question as abuse, that means more also to awake a moderator so he can move this thread.
Because the answer is the same, if you want to get a folder direct, then get it by using the io.directoryinfo. 
https://msdn.microsoft.com/en-us/library/system.io.directoryinfo%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
If you have to search for it, then it is slow and you have to do it recursive. Also there are bugs in that part of the software if it is about disk drives.
(Only to skip with Try and Catch, try and catch)
Success
Cor

Similar Messages

  • Help Please with searching Hard Drive for MP3's etc

    Right I installed ITunes and in the install it said do you want ITunes to search your harddrives for MP3s to add to the library. Which I said Yes. I have all mu music on a 200gb External Hard Drive.
    WHen it finished the search I had 5 files in my library that were on my desktop.
    How do I ask ITunes to search my external harddrive for the rest of my music without importing individually??
    Many Thanks in Advance

    Just use the Add to Library command (under the File menu) and select the folder(s) on your external drive in which your music is stored.

  • Search network drive for large files

    Our network drives are getting full. I used to be able to use Find File to find files larger than a certain size. I hit command-F for finding the file, have it set to search the volume I want for files with size greater than 80 MB, but when I hit return to start the search nothing happens--no spinning arrow showing that it's "thinking". I don't want to specify anything in the window with the magnifying glass, since I don't know file names. Any suggestions, or is this just something that you can't do with 10.4.8 (the version on my machine at work)?

    Never mind. I found out that if I add specific folders I want to search inside, it works. It just doesn't want to search the volume.

  • I search a driver for modbus ascii in labview 6.i

    i have some problems with the termination characters. cr lf.. because my device not respond

    Hi,
    You can find a ModBus driver using ASCII (and RTU) transmission mode at this URL :
    http://www.saphir.fr/SAPHIRnet/Admin/home.htm
    There is downloadable exe demo. It can help you to test your communication.
    Olivier JOURDAN
    SAPHIR | Certified LabVIEW Architect | Topaze on NI Community | LabVIEW add-ons on NI Community | Follow me on Twitter

  • Search c:\ drive and return file path for winword.exe and save as variable

    Hi all, here is what I'm trying to do;
    1. Search C:\ drive for winword.exe
    2. take the file path and save it as a variable.
    3. Then based on the path value, use the switch statement to run "some command" 
    Essentially I'm trying to find what the file path for winword.exe is, then run a command to modify the registry.  I already have the script that will modify the registry like I want but the problem it, the path is hard coded in the script, I want to
    now look for all versions of word and set the right file path so I can make the right registry changes.

    This should get you started:
    http://ss64.com/ps/get-childitem.html
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How to search for particular string in array?

    I am struggling to figure out how to search array contents for a string and then delete the entry from the array if it is found.
    The code for a program that allows the user to enter up to 20 inventory items (tools) is posted below; I apologize in advance for it as I am also not having much success grasping the concept of OOP and I am certain it is does not conform although it all compiles.
    Anyway, if you can provide some assistance as to how to go about searching the array I would be most grateful. Many thanks in advance..
    // ==========================================================
    // Tool class
    // Reads user input from keyboard and writes to text file a list of entered
    // inventory items (tools)
    // ==========================================================
    import java.io.*;
    import java.text.DecimalFormat;
    public class Tool
    private String name;
    private double totalCost;
    int units;
      // int record;
       double price;
    // Constructor for Tool
    public Tool(String toolName, int unitQty, double costPrice)
          name  = toolName;
          units = unitQty;
          price = costPrice;
       public static void main( String args[] ) throws Exception
          String file = "test.txt";
          String input;
          String item;
          String addItem;
          int choice = 0;
          int recordNum = 1;
          int qty;
          double price;
          boolean valid;
          String toolName = "";
          String itemQty = "";
          String itemCost = "";
          DecimalFormat fmt = new DecimalFormat("##0.00");
          // Display menu options
          System.out.println();
          System.out.println(" 1. ENTER item(s) into inventory");
          System.out.println(" 2. DELETE item(s) from inventory");
          System.out.println(" 3. DISPLAY item(s) in inventory");
          System.out.println();
          System.out.println(" 9. QUIT program");
          System.out.println();
          System.out.println("==================================================");
          System.out.println();
          // Declare and initialize keyboard input stream
          BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
          do
             valid = false;
             try
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
                valid = true;
             catch(NumberFormatException exception)
                System.out.println();
                System.out.println(" Only numbers accepted. Try again.");
          while (!valid);
          while (choice != 1 && choice != 2 && choice != 9)
                System.out.println(" Not a valid option. Try again.");
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
          if (choice == 1)
             // Declare and initialize input file
             FileWriter fileName = new FileWriter(file);
             BufferedWriter bufferedWriter = new BufferedWriter(fileName);
             PrintWriter dataFile = new PrintWriter(bufferedWriter);
             do
                addItem="Y";
                   System.out.print(" Enter item #" + recordNum + " name > ");
                   toolName = stdin.readLine();
                   if (toolName.length() > 15)
                      toolName = toolName.substring(0,15); // Convert to uppercase
                   toolName = toolName.toUpperCase();
                   dataFile.print (toolName + "\t");
                   do
                      valid = false;
                      try
                         // Prompt for item quantity
                         System.out.print(" Enter item #" + recordNum + " quantity > ");
                         itemQty = stdin.readLine();
                         // Parse integer as string
                         qty = Integer.parseInt (itemQty);
                         // Write item quantity to data file
                         dataFile.print(itemQty + "\t");
                         valid=true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-integer input
                         System.out.println();
                         System.out.println(" Only whole numbers please. Try again.");
                   while (!valid);
                   do
                      valid = false;
                      try
                         // Prompt for item cost
                         System.out.print(" Enter item #" + recordNum + " cost (A$) > ");
                         itemCost = stdin.readLine();
                         // Parse float as string
                         price = Double.parseDouble(itemCost);
                         // Write item cost to data file
                         dataFile.println(fmt.format(price));
                         valid = true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-number input (integers
                      // allowed)
                         System.out.println();
                         System.out.println(" Only numbers please. Try again.");
                   while (!valid);
                   // Prompt to add another item
                   System.out.println();
                   System.out.print(" Add another item? Y/N > ");
                   addItem = stdin.readLine();
                   while ((!addItem.equalsIgnoreCase("Y")) && (!addItem.equalsIgnoreCase("N")))
                      // Prompt for valid input if not Y or N
                      System.out.println();
                      System.out.println(" Not a valid option. Try again.");
                      System.out.print(" Add another item? Y/N > ");
                      addItem = stdin.readLine();
                      System.out.println();
                   // Increment record number by 1
                   recordNum++;
                   if (addItem.equalsIgnoreCase("N"))
                      System.out.println();
                      System.out.println(" The output file \"" + file + "\" has been saved.");
                      System.out.println();
                      System.out.println(" Quitting program.");
            while (addItem.equalsIgnoreCase("Y"));
    // Close input file
    dataFile.close();
       if (choice == 2)
       try {
          Read user input (array search string)
          Search array
          If match found, remove entry from array
          Confirm "deletion" and display new array contents
       catch block {
    } // class
    // ==========================================================
    // ListToolDetails class
    // Reads a text file into an array and displays contents as an inventory list
    // ==========================================================
    import java.io.*;
    import java.util.StringTokenizer;
    import java.text.DecimalFormat;
    public class ListToolDetails {
       // Declare variable
       private Tool[] toolArray; // Reference to an array of objects of type Tool
       private int toolCount;
       public static void main(String args[]) throws Exception {
          String line, name, file = "test.txt";
          int units, count = 0, record = 1;
          double price, total = 0;
          DecimalFormat fmt = new DecimalFormat("##0.00");
          final int MAX = 20;
          Tool[] items = new Tool[MAX];
          System.out.println("Inventory List");
          System.out.println();
          System.out.println("REC.#" + "\t" + "ITEM" + "\t" + "QTY" + "\t"
                + "PRICE" + "\t" + "TOTAL");
          System.out.println("\t" + "\t" + "\t" + "\t" + "PRICE");
          System.out.println();
          try {
             // Read a tab-delimited text file of inventory items
             FileReader fr = new FileReader(file);
             BufferedReader inFile = new BufferedReader(fr);
             StringTokenizer tokenizer;
             while ((line = inFile.readLine()) != null) {
                tokenizer = new StringTokenizer(line, "\t");
                name = tokenizer.nextToken();
                try {
                   units = Integer.parseInt(tokenizer.nextToken());
                   price = Double.parseDouble(tokenizer.nextToken());
                   items[count++] = new Tool(name, units, price);
                   total = units * price;
                } catch (NumberFormatException exception) {
                   System.out.println("Error in input. Line ignored:");
                   System.out.println(line);
                System.out.print(" " + count + "\t");
                System.out.print(line + "\t");
                System.out.print(fmt.format(total));
                System.out.println();
             inFile.close();
          } catch (FileNotFoundException exception) {
             System.out.println("The file " + file + " was not found.");
          } catch (IOException exception) {
             System.out.println(exception);
          System.out.println();
       //  Unfinished functionality for displaying "error" message if user tries to
       //  add more than 20 tools to inventory
       public void addTool(Tool maxtools) {
          if (toolCount < toolArray.length) {
             toolArray[toolCount] = maxtools;
             toolCount += 1;
          } else {
             System.out.print("Inventory is full. Cannot add new tools.");
       // This should search inventory by string and remove/overwrite matching
       // entry with null
       public Tool getTool(int index) {
          if (index < toolCount) {
             return toolArray[index];
          } else {
             System.out
                   .println("That tool does not exist at this index location.");
             return null;
    }  // classData file contents:
    TOOL 1     1     1.21
    TOOL 2     8     3.85
    TOOL 3     35     6.92

    Ok, so you have an array of Strings. And if the string you are searching for is in the array, you need to remove it from the array.
    Is that right?
    Can you use an ArrayList<String> instead of a String[ ]?
    To find it, you would just do:
    for (String item : myArray){
       if (item.equals(searchString){
          // remove the element. Not trivial for arrays, very easy for ArrayList
    }Heck, with an arraylist you might be able to do the following:
    arrayList.remove(arrayList.indexOf(searchString));[edit]
    the above assumes you are using 1.5
    uses generics and for each loop
    [edit2]
    and kinda won't work it you have to use an array since you will need the array index to be able to remove it. See the previous post for that, then set the value in that array index to null.
    Message was edited by:
    BaltimoreJohn

  • Driver for hp laserjet 1215???, driver for hp laserjet 1215???, driver for hp laserjet 1215???

    im searching a driver for hp laserjet 1215???

    This printer doesn't seem to be supported in ML:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01664444&lc=en&cc=us&dlc=en &product=412187#N2043
    You could try the 1515 driver or use the Generic PostScript Printer PPD when adding the printer.
    Hope this helps.

  • Driver for PM5193 on Labview6.1

    Hi,
    I'm searching a driver for a function generator Fluke/Philips PM5193 for Labview6.1. I have found the driver for Labview7 and 8 but not for Labview6.
    I'm using a GPIB card and I must use the Labview6.1.
    Thank you for your help.

    Hi,
    Like you mentioned, the mininum requirements to use the driver is LabVIEW 7.0. As you probably know National Instruments does not maintain or support this driver. My suggestion would be that you try to post this on the DAQ/GPIB discussion forum to see if another customer has developed the driver for LabVIEW 6.1
    Warm regards,
    Karunya R
    National Instruments
    Applications Engineer

  • XP Driver for Web-Cam model no. 1100001212

    hi,
    search XP driver for my webcam model no. 000022
    thx
    baddie

    Hi, exactly the matrix driver is the right one for the Sata controler look here
    choose the right version for your chipset , look for version for floppy 32bit , run it take some diskette put , and this file will put the drivers right to diskette, then copy this files from diskette, and save them somewhere on the hard (by the way DO THIS ON SOME other computer) . the name of the floopy manager file is "f6flpy32"
    If you already have the sata drivers (extracted files from this file ''f6flpy32'')
    Take the tirth party program called: "nLite" copy the disired windows to a folder on the pc, and then turn on the nLite program (the program runs only on windows XP SP2 or Windows Vista) and follow the steps first screen is for the windows that you already copy on the pc (choose where is he) secound screen i think was for the sata driver (choose where is he) and follow the other steps until it finish, then will run to modify the new windows (with integrated sata driver for sata for XP).
    here is the right link for the matrix driver for L40-14F http://www.intel.com/support/chipsets/sb/CS-025753.htm
    (Choose Intel?® Matrix Storage Manager, choose XP, then Floopy "
    32-bit Floppy Configuration Utility for Intel?® Matrix Storage Manager")
    Good Luck!

  • How can I search for a string like a partial IP address in the global search

    When searching for a string like "10.255." the global search finds messages containing "255" or "10" and both.
    This happens no matter whether quotation is used or not.
    When quotation is used it probably will match on the given order as well, but beeing in the timezone '+0100' the string "10" is always found first (in the email headers...).
    Is there a way to tell the global search not to use '.' or any other character as whitespace?

    When searching for a string like "10.255." the global search finds messages containing "255" or "10" and both.
    This happens no matter whether quotation is used or not.
    When quotation is used it probably will match on the given order as well, but beeing in the timezone '+0100' the string "10" is always found first (in the email headers...).
    Is there a way to tell the global search not to use '.' or any other character as whitespace?

  • How do i search for a string in a txt file using java??

    How do i search for a string in a txt file using java??
    could you please help thanks
    J

    Regular expressinos work just fine, especially when
    searching for patterns. But they seem to be impying
    it's a specific group of characters they're looking
    for, and indexOf() is much faster than a regex.If he's reading from a file, the I/O time will likely swamp any performance hit that regex introduces. I think contains() (or indexOf() if he's not on 5.0 yet) is preferable to regex just because it's simpler. (And in the case of contains(), the name makes for a very clear, direct mapping between your intent and the code that realizes it.)

  • Powershell script to search a network drive for .mdb files and export them to CSV file

    Hello all,
    I'm trying to search one of our network drives for old .mdb files, I want to write the name, location and date last modified to a csv file.
    Get-WmiObject -Class CIM_DataFile -Filter "Drive='S:' And Extension='mdb'
     AND ObjFile.drive
     AND objFile.FileName
     AND objFile.FileSize
     AND objFile.LastWriteTime" |
    Export-CSV c:\mdb_search\mdbfiles.csv\
    Obviously this isn't working or I wouldn't be posting.  I've tried many different examples from the net with no joy for now.
    Thanks for any help you can offer.

    Thanks, that did the job.
    Cheers, you're welcome.
    How do I get the powershell cursor to return to C:> ?
    Should I use "exit" or "break" ?
    Neither, the console will return to a prompt when the search has been completed.
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • How to search for a string in ALL Function Modules source code

    Hello,
    I want to search for the string "HELLO" in all FUNCTION MODULES source code(FM, no reports/programs).
    Is this possible? How?
    Cheers,
    Andy

    hi,
    Execute RPR_ABAP_SOURCE_SCAN to search for a string in the code ... Press where-used-list button on the program which takes to the function group or the function module where it is used ..
    Regards,
    Santosh

  • Searching for a string in given text file

    Hi,
    I have two strings and i need to search the entire file for the strings and highlight the lines between the strings
    say, for example,
    hi this is xyz
    i am a begineer in java
    can i have some help in this issue please
    i gave 'hi' and 'can' i need the three lines to be highlighted
    can you give me an idea about this.
    how to proceed
    thanks all in advance
    Edited by: anub on Feb 6, 2009 3:24 AM

    Here's an idea. Find a link to the java API. Create a utility class with a method to read a file and a method to write a file. Look in java.io for this. That should keep you busy for a while and give you something specific to ask questions about. Next, create a GUI class and put a button on it. Figure out how to make a button click open a "FileChooser" or "JFileChooser" (Look in the api for that) Imagine that these need to talk to each other so figure out what parameters are needed. After you've done that then figure out how the user is going to enter the two search criteria (something that acts like a text field). Choose a GUI class that supports text highlighting. Display all the information that the user would like to know e.g. The name of the file selected to parse, the name of the file to write, and whether the strings were found successfully.
    kr
    walker

  • Searching for a string in an excel file and return true if found.

    How can I search for a string in an excel file and return true if found, its location and also a value.

    The problem with searching an excel file is that it contains a header. It would be easiest if you just read the file into a LabVIEW array and search the array. This way you can also get the index and the value of the location.

Maybe you are looking for

  • Payables Open Interface Import rejection

    Hi All Encountered an issue with Payables Open Interface Import. An invoice is getting rejected with reason 'INVALID SUPPLIER'. I have imported invoices for the same supplier as part of data conversion. The only change in data as compared to the tran

  • Embedding Fonts in Acrobat 9 Pro

    I'm using the trial version of Acrobat to work on a project, and I'm having trouble embedding the fonts. I'm following the instructions provided in the online documentation, and I can select the text with the Touchup Text Tool, but that's where I get

  • Concatenating a string in a URL syntax does not work (syntax error)

    I am trying to print a Report in PDF format. The code is: select '<a href="http://oasdev.oh.gov./reports/rwservlet?GDMS_ACR&Y='||:P106_YEAR||'&B='||:P100_BUSINESS_UNIT_ID||'&C='||:P106_COMMISSION_ID||'&d=('||TO_CHAR(SYSDATE,'MMDDYYYYhhMISS')||')", ta

  • G6-1105tx notebook is not charging

    I have bought a new hp pavilion g6 1105tx 20 days ago. From last few days I m facing a problem about charging. I put my laptop on charging but maximum time it showing plugged in not charging. kindly help me. Is it problem with battery or ac adapter o

  • PDF file issue

    Hi guys, I have been given lots of PDF files which I have been asked to add to a website. I'm developing a school website and these are homework files which are for the kids to access their work online. However i'd like a spot of advice on how I get