+ Start a Discussion

Remove all classes from org using Ant



I want to remove all(say 100) classes from my org using ant. So i can not specify the name of individual class in destructiveChanges.xml file. Hence i tried to create it like below:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">


But i am getting error "No ApexClass Named: * found"


can someone please help me on this?


Thanks in Advance!!!!


destructiveChanges.xml does not work with wildcards.

You will have to mention every single class in the file.


But I do not want to specify every class name. Is there any other method to do this?


If it is a one-off activity then you could use Force.com IDE for Eclipse.


If you need to do this regularly or can not use Force.com IDE and have to stick with Ant then:

1. use Ant "listMetadata" task to retrieve list of all classes

2. write that list in destructiveChanges.xml file - whether you just copy/paste or write a script to populate destructiveChanges.xml is up to you