•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 361,867 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,444 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 724 | Replies: 9
![]() |
•
•
Join Date: Nov 2004
Location: Netherlands
Posts: 5,576
Reputation:
Rep Power: 18
Solved Threads: 184
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.
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.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
•
•
Join Date: Mar 2007
Posts: 45
Reputation:
Rep Power: 0
Solved Threads: 1
•
•
•
•
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
•
•
Join Date: Mar 2007
Posts: 45
Reputation:
Rep Power: 0
Solved Threads: 1
•
•
•
•
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?
Re: how can we find out the size of a file or a directory using IO package in java
#6
Oct 17th, 2007
•
•
•
•
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?
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.
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.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
- Header files, C++ vs C compiler question (C++)
- plz tell y it is? (Java)
- plz help me solving below programs (C)
- Windows won't start...can i save my files?? (Windows NT / 2000 / XP / 2003)
- Ellips arugument (C)
- Where to get started with Web Programming (IT Careers and Business)
- Internet Explorer Fails After Registry Removal (Viruses, Spyware and other Nasties)
- Pop up Problems again (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: Hi Help me with Multilevel feedback scheduling
- Next Thread: jvm error



Linear Mode