Please develop code

Please develop code

i want to develop a program that search a file in a directory and its subdirectories and rename that file with name of main directory
View Answers

April 7, 2010 at 5:33 PM

Hi Friend,

Following code searches the file.

import java.io.*;
import java.util.*;
public class SearchFile {

private static void traverse(String name, File dir ) {
File [] children = dir.listFiles();
for(File file : children) {
if(file.isFile()) {
if(file.getName().equals(name)){
System.out.println(file.toString());
}
} else {
traverse(name, file);
}
}
}

public static void main(String[] args) throws Exception{
traverse("in.txt",new File("C:/"));
}
}

Thanks









Related Tutorials/Questions & Answers:
Please develop code - Development process
Please develop code  i want to develop a program that search a file in a directory and its subdirectories and rename that file with name of main directory  Hi Friend, Following code searches the file. import
develop code - Java Beginners
develop code   i want to develop a program that search a file in a directory and its subdirectories and rename that file with name of directory
Advertisements
please provide the code
please provide the code   Develop a multi-client chat application
please give me an idea to develop a program for this question?
please give me an idea to develop a program for this question?  How to enter a text or number from keyboard without using InputStreamReader method in java
Please provide the code
Please provide the code   Write a program to recursively download the web pages available in the given site URL
Please provide the code
Please provide the code   Program to find depth of the file in a directory and list all files those are having more number of parent directories
Please provide the code
Please provide the code   Create a file system: We just have one file on the hard disk. But we can create directories, sub-directories and files in that file only
Please help with this code
Please help with this code  I need some help getting the Search method below to work with the menu, and I also cannot figure out how to get my bubble sort to work. I've spent a long time on this and think my brain is just fried
Provide the code please
Provide the code please   Program to calculate the sum of two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
please provide code - Java Beginners
please provide code  provide code to snake game in J2SE
please send code - Java Beginners
please send code  hai friends plese provide code for fallowing... number it should be taken as single number) URGENTLY send the code for this  Hi friend, Code to solve the problem : class StringExampleJava
could anyone please help with the code.
could anyone please help with the code.  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException...(request, response); } } could anyone please check the code. If i enter
ajax code please help to solve this........
ajax code please help to solve this.  in this i am trying to get data... null; } please help me when i am running this it show an error... the fourth one similarly. For the above code, we have used 3 database tables
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Please explain what is hibernatetemplate with an example code.
Please explain what is hibernatetemplate with an example code.  hi, Please explain Hibernate template example code to me..   Hello Friend... is org.springframework.orm.hibernate.HibernateTemplate Please follow the given link for more details: hibernateTemplate
Please tell me the code to generate the below structure
Please tell me the code to generate the below structure  1 2 3 4 5 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 7 8 9 1 2 8 9 1 9 1 2 8 9 1 2 3 7 8 9 1 2 3 4 6 7 8 9 1 2 3
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  Q 1) In a class first day 25 students are joined. After two days that total students will increased to 60. We can develop a program by using ArrayList concept
Not sure whats wrong with my code HELP PLEASE?!?!
Not sure whats wrong with my code HELP PLEASE?!?!  I cant figure out what I am doing wrong in my code can anyone help me out??? Grades ADS_TO_REPLACE_1 function computeGrade( ) { var hw, lab, midt, fin, avg; hw
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI    THE CODES ARE BELOW...; } else screen.displayMessageLine( "\nInvalid account Nummber or PIN, Please...; screen.displayMessageLine("\n Your cash has been"+ "dispensed. please take your cash
Please help me fix this code - MobileApplications
Please help me fix this code   Please help me in this area of code... in the background of the forms in this code i want to sum all expenses amount... expenses)", "Please fill all required field \n \n * This signify required field
please help me to give code - Java Beginners
please help me to give code  Write a function, sliding(word, num)that behaves as follows. It should print out each slice of the original word having length num, aligned vertically as shown below. A call to sliding(examples, 4
please help me to give code - Java Beginners
please help me to give code  Write a function with a signature cheerlead(word) that prints a typical cheer as follows. The word robot: Gimme an R Gimme an O Gimme a B Gimme an O Gimme a T What did you give me? ROBOT
Please write code for this program in java and Explain it ? pl'sssssssss
Please write code for this program in java and Explain it ? pl'sssssssss  Question: We are given an array of 2n integers wherein each pair in this array of integers represents the year of birth and the year of death
Please provide the java code for the given program.
Please provide the java code for the given program.   We need an application for managing an educational institute. That application should provide the details of Students Courses Faculty Fee details etc..,   
please reply the code to store dynamic fields in database?
please reply the code to store dynamic fields in database?  <%@ page import ="java.sql.*" %> <%@ page import ="javax.sql.*" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <title>Login User<
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI  THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent... account Nummber or PIN, Please try again."); } private void
please help me to give code - Java Beginners
please help me to give code  Write a program that prints an n-level stair case made of text. The user should choose the text character and the number of stairs in the stair case * ** *** ****   Hi friend
please help me to give code - Java Beginners
please help me to give code  Write a program that uses loops to generate an n x n times table. The program should get n from the user. As a model here is a 4 x4 version: | 1 2 3 4
please help me to give code - Java Beginners
please help me to give code  Write a program that reads a file named famous.txt and prints out the line with the longest length. In the case of a tie, you may print out only one of them. For example in the file: Alan Turing
Please provide jquery inline form validation for the code
Please provide jquery inline form validation for the code   <html> <head> <meta http-equiv="Content-Type" content="text/html...; </table> </form></body></html>   Please visit
Please help me to modify my java code from php code
]; } } I tried like this (see below JSP code) ... but this is not giving me the exact result as the above PHP code is giving. So please help me to convert...Modify Java code from PHP Code  i want to covert this php code int
Please help me to modify my java code from php code
Please help me to modify my java code from php code  i want to covert this php code int java/JSP . if (isset($_POST['orders'])) { $orders...) ... but this is not giving me the exact result as the above PHP code is giving. So please
how to send email please give me details with code in jsp,servlet
how to send email please give me details with code in jsp,servlet  how to send email please give me details with code in jsp,servlet
i want java code for this xml file...please show me..
i want java code for this xml file...please show me..   xbrli:shares xbrli:pure iso4217:INR
Please help me to write a code for add contacts to groups in a website?
Please help me to write a code for add contacts to groups in a website?   Iam developing a site. In that site I need to write code for Groups... send a code for this? Please make it fast
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  1) Copy one file content to other? 2) Count the number of words in a file
Please Provide the direct Downloadable source code for better understanding
Please Provide the direct Downloadable source code for better... clear.* As am a fresher, it is difficult for me to implement the code practically. I kindly request you to please provide the direct downloadable source code so
please send me javascript validation code - Java Beginners
please send me javascript validation code  hallo sir , please send me java script code for this html page.since i want to do validation.i am a new user in java ....please send me its urgent
this is my javascript code and i am not understanding the mistake in this,please help me?
this is my javascript code and i am not understanding the mistake in this,please help me?  <html> <h2>Form Validation</h2>...; if((nn1.value==null)||(nn1.value=="")){ alert("Please Enter
try to execute this code getting class cast exception, please resolve it.
try to execute this code getting class cast exception, please resolve it.  package test; import java.util.Arrays; import java.util.HashSet; import... int[] removeDuplicates(int[] a) { /* Please implement this method
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone  The Airport Valet Parking Company (AVP) is a company which provides a convenient medium cost parking solution to users of a local airport. Key
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my code is supposed to ask for an input file and then (ex: input.txt), read... in the file. Also it should be displayed on the screen. However my code doesn't display
Please explain this code as many packages and classes are unknown to me .!
Please explain this code as many packages and classes are unknown to me .!  print("code sample");package bluetooth; import java.io.OutputStream; import javax.microedition.io.Connector; import javax.obex.ClientSession; import
Please give me the code for the below problem - Java Interview Questions
Please give me the code for the below problem  PROBLEM : SALES TAXES Basic sales tax is applicable at a rate of 10% on all goods, except books... Vidya  Hi Friend, Try the following code: import java.util.
sir, how to convert excel file to csv file using java? please send me sample code.
sir, how to convert excel file to csv file using java? please send me sample code.  please send me sample code for converting excel file into csv file uisng java
i want to create website,with manu with three level submenu on top side of page please send me code java
i want to create website,with manu with three level submenu on top side of page please send me code java   iam createing wibsite thats using eclipse andtomcat server,please help me to write menu with three level submenu
please let me get code how to insert a data to mysql using setter and getter method by using java
please let me get code how to insert a data to mysql using setter and getter method by using java  please let me get code how to insert a data to mysql using setter and getter method by using java pelease let me have the code
please let me get code how to insert a data to mysql using setter and getter method by using java
please let me get code how to insert a data to mysql using setter and getter method by using java  please let me get code how to insert a data to mysql using setter and getter method by using java pelease let me have the code
why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...
why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...   public class d55 { int squares = 81; public static void main(String

Ads