• Post Reply Bookmark Topic Watch Topic
  • New Topic

Wildcard delete w/ File Object?

 
Elle Atechsy
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Is it possible to do a delete with the File object using wildcard symbol: *


If not, can anyone suggest a way I can delete files from a Unix/Linux file system using wildcards in Java?

Thanks!
Lulu
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime.exec()
Be aware of the pitfalls.
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May I suggest this another approach:



I hope it helps!
 
J Aitch
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edwin Dalorzo, that code snipit is poetry. I just added something based on it to the uninstall code of a Netbeans application to remove my log files so the uninstall would be clean. Thanks!
.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use Java 7, you can also use Files.newDirectoryStream(Path, String).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!