wood burning stoves*
The moose likes Ant, Maven and Other Build Tools and the fly likes How to delete a directory in unix box using ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to delete a directory in unix box using ant " Watch "How to delete a directory in unix box using ant " New topic
Author

How to delete a directory in unix box using ant

Devi Sri
Ranch Hand

Joined: Dec 20, 2005
Posts: 114

Hi Ranchers,

Please help me.

How to delete a directory from a unix box by using ant?

Could you please suggest me ?

Thanks in advance.
[ August 13, 2008: Message edited by: Devisri Nanubala ]

Devisri, SCJP 5.0, SCWCD 5.0
"Dream is Not what you see in sleep. Dream is that which never lets you sleep" - Abdul Kalam
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9329
    
110

Ant has the Delete task which can be used for doing this.


[My Blog] [JavaRanch Journal]
Devi Sri
Ranch Hand

Joined: Dec 20, 2005
Posts: 114

Hi Jaikiran,

But that delete task is not working for my process.
As my unix box is on remote machine connected through ssh.

And I need to delete a directory in that remote unix box, through my local machine ant build.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2477
    
    7

Originally posted by Devisri Nanubala:
... As my unix box is on remote machine connected through ssh.

And I need to delete a directory in that remote unix box, through my local machine ant build.


You can execute commands on the remote box using the ant SSHEXEC optional task.

The unix command to unconditionaly remove a directory, even if it is not empty, is
(take care, danger!)

rm -fr dirname
[ August 13, 2008: Message edited by: Jan Cumps ]

OCUP UML fundamental and ITIL foundation
youtube channel
Devi Sri
Ranch Hand

Joined: Dec 20, 2005
Posts: 114

Hi Jan,

Thankyou. It's working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to delete a directory in unix box using ant
 
Similar Threads
Connecting to Unix via Windows
File.canWrite()?
If I wanted to connect and read files from remote unix box using java application
unable to create directory using ftp task
Weblogic Data source