1)I need to compare two directories .if the files which r not same in the two directories i want to list them in a new text file
can anybody help me solving this question
2)how to write in a file in a String format using java?
satish.paluvai
1)I need to compare two directories .if the files which r not same in the two directories i want to list them in a new text file
can anybody help me solving this question
2)how to write in a file in a String format using java?
satish.paluvai
1.) Look at the API for File.
2.) Look at the API for BufferedWriter.
And define "not the same".
What are you going to use as criteria?
Names only? Sizes too? Or the actual content (and if that, how strict are you going to be? If they're 2 text files that differ only in whitespace, do you consider them the same or not?)?
Get your requirements straight before you even start thinking about putting something together.
And define "not the same".
What are you going to use as criteria?
Names only? Sizes too? Or the actual content (and if that, how strict are you going to be? If they're 2 text files that differ only in whitespace, do you consider them the same or not?)?Get your requirements straight before you even start thinking about putting something together.
yes I want to check two file have to be same in the name , size and also if the two directories have any sub directories and the files in the subdirectories those also it must be compared
yes I want to check two file have to be same in the name , size and also if the two directories have any sub directories and the files in the subdirectories those also it must be compared
plz help me how can we find out the size of a file or a directory using IO package in java?
plz help me how can we find out the size of a file or a directory using IO package in java?
I've already told you: File has all of the methods you need. The length() method returns the length of the file in bytes. If the file is a directory, you will need to recursively sum up the length of the files in the that directory, which is obtained with the list() method.
If you had taken the time to look at the APIs that I suggested this should have been fairly straightforward.
ok,thanks for giving the clue
can we copy a file from one directory to another directory using java?
ok,thanks for giving the clue
can we copy a file from one directory to another directory using java?
Java does not have a native copy method. You must write your own short method for this using the IO classes. There are many implementations of copy available on the internet.
can u just suggest one idea (for copying the files from one directory to another)
Read the API for FileChannel. The source and destination directory does not make any difference whatsoever, as you are always dealing with two file (or file channel) objects. Where they are makes no difference (to a point). Stop focusing on this system and/or procedural type stuff.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.