File Change Detector In Java ( 95% implemented but require help in one case)

My Project is : File Change Detector: The input to the application will be a group of directories and files. When the application runs for the first time it will simply summarize the names and sizes of the files. On subsequent runs it should report

  1. Name of the files that have been deleted since last run
  2. New files created since last run
  3. Files whose size have grown more than x% and
  4. Files whose size have reduced more than x%.

I have implemented a java program which scans user selected folder via JFileChooser and performs all functionality .

But the problem is, if a user creates two files with same name in different subfolder of "SELECTED" main problem , it leads to ambiguous condition and hence project fails.

How to Differentiate Two Files ie one in C:\Main\SubFolder1\a.txt and C:\Main\SubFolder2\a.txt....(Both have same size and created on same time)

Answers


Store the path of the file as well. After all, you just realized that two files with the same name can exist in different directories being different files.

Either that, or if you really want to disregard the directory, then you should enumerate them if you encounter more than one entry with the same name.

The Filechooser returns the full path:

 String Path = chooser.getSelectedFile().toString();

Need Your Help

How do I declare a list of fixed length in specman?

hardware specman eda

In E (specman) I want to declare variables that are lists, and I want to fix their lengths.

NSNumber doubleValue method returns null in objective C (IOS)

objective-c ios nsnumber

I am doing some iOS learning and I have an NSNumber which appears to be in order but when I ask for the doubleValue of it, I get null.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.