• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven


Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I have a directory name /abc/Foo/allFilesHere that created by user "A" and Foo directory mode is 777 and allFilesHere is 444. By using Unix scripting allows me to delete or modify all the files under "Foo" directory. [except no allow to change mode chmod]
Now the problem i'm facing is by using Java, File.canWrite() [under the "Foo" directory] it return me false. How should i able to delete the file using java while File.canWrite() return me false?
Thanks in advance.
Posts: 3035
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I remember right, having a directory with 777 permissions that contains a file with 444 permissions sets up a somewhat paradoxical situation in Unix. You can't directly modify the file, because it is read only, but you can delete it and create another with the same name. That's because those are directory operations and you have full permissions on the directory. Your Java application is obliged to follow the same rules that the command-line shell does.
Every plan is a little cooler if you have a blimp. And a tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!