This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply 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: 8145
    
  52

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: 2343

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
ITIL foundation
Devi Sri
Ranch Hand

Joined: Dec 20, 2005
Posts: 114

Hi Jan,

Thankyou. It's working.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to delete a directory in unix box using ant
 
Similar Threads
Weblogic Data source
File.canWrite()?
If I wanted to connect and read files from remote unix box using java application
Connecting to Unix via Windows
unable to create directory using ftp task