Results 1 to 8 of 8
- 07-21-2011, 07:51 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
File created/Directory changed Events in java
Hi All,
This is krishna new to Java .
My task is To create a 100 files in a directory . Initially Directory is empty , when ever a file is created or Directory
changes (means New file is created) An event to be occur which will call some other action to be implemented.
Thank you,
krishna
- 07-21-2011, 08:14 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Could you explain bit more that what you really want to do?
- 07-21-2011, 08:51 AM #3
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
Thanks for Reply
What i want exactly is ,In java I created 100 files using files concept. like file1,file2,......file100
in some directory say "c:/krishna".
Now My question is while running my program (creation of files) i want to see if directory is changed i want to
perform some action .is there any events like directory or folder changed events in java.
- 07-21-2011, 09:00 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You have several option for that.
1. You can simple deals with the file count in that folder. But you have to do it periodically.
2. (this is what I suggest you) If all the files are created from your own applications you must have a notion about the file creating one by one. So perform your action within that level.
- 07-21-2011, 09:23 AM #5
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
Thanks for ur time,
Is there any idea like By using Events in java.
- 07-21-2011, 09:27 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Event sense what you want to do once a new file is created in that folder?
- 07-21-2011, 09:40 AM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,398
- Blog Entries
- 7
- Rep Power
- 17
Java 7 has that functionality; it has a Watch Service that can notify you whenever there is a change in a directory; Java 6 and below don't have it and you should implement it yourself by periodically scannnng the entire directory for changes. This approach doesn't scale well though ...
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-21-2011, 10:40 AM #8
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
running the created jar file
By Mostafa_mech in forum NetBeansReplies: 12Last Post: 07-02-2010, 11:06 AM -
java.io.IOException: error=2, No such file or directory
By NARs in forum New To JavaReplies: 5Last Post: 11-22-2009, 04:48 PM -
How can i execute one java file(dynamically created) from the other
By Rak239 in forum New To JavaReplies: 1Last Post: 11-03-2009, 07:07 AM -
java.io.FileNotFoundException: (No such file or directory)
By sudukrish in forum Advanced JavaReplies: 1Last Post: 04-01-2009, 07:34 PM -
How to find file created date.....
By roshithmca in forum Advanced JavaReplies: 1Last Post: 02-18-2008, 09:48 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks