A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Joined: Mar 14, 2006
May 14, 2007 00:11:00
While i am reading the files inside a directory, I need to lock that particular directory so that no new file get added/deleted. Can anyone please let me know how can i go abt.
Joined: Oct 30, 2001
May 14, 2007 00:59:00
Pre Java 6, you can't do this with Java. You'd have needed to call the operating system, via shell or JNI.
In Java 6, you might find java.lang.File.setWritable() does what you want. However, setting a directory unwritable is neither friendly nor reliable.
You'd be much better off thinking of how your application can be redesigned to cope with normal directory behaviour.
[ May 14, 2007: Message edited by: Peter Chase ]
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I agree. Here's the link:
subject: Locking directory
View direct through a web service question
eclipse, open a file outside a project
How can a program point to a a different directory
file handling in java
reading files in specified directory
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013