I am having some trouble with the ListFiles() method and I am hoping that someone can shed some light on my problem. Here is a simple program I am trying to work with;
/*****************************************************************************\
*
* FILE: BatchBackup.java
* PURPOSE: To backup all files from a workspace to a local directory
* 05-Jan-06 Andy Ley
*
* \*****************************************************************************/
import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcGlobal.*;
import com.ptc.pfc.pfcModel.*;
import com.ptc.pfc.pfcExceptions.*;
import com.ptc.pfc.pfcBase.*;
public class ThisWorks {
private static String fileTypeFilter = "*";
private static Session session;
private static Model proeModel;
private static String workSpace = "wtws://Windchill Server/chair/";
private static String directory;
private static ModelDescriptor descrModel;
/**
* J-Link start method
*/
public static void start() {
try {
session = pfcGlobal.GetProESession();
stringseq fileNames = session.ListFiles(fileTypeFilter, FileListOpt.FILE_LIST_LATEST, workSpace);
for (int i = 0; i < fileNames.getarraysize(); i++) {
String name = fileNames.get(i);
ModelDescriptor proeFileDescriptor=
pfcModel.ModelDescriptor_CreateFromFileName(name);
if (proeFileDescriptor.GetType() == ModelType.MDL_PART || proeFileDescriptor.GetType() == ModelType.MDL_ASSEMBLY){
try{
proeModel = session.RetrieveModel(proeFileDescriptor);
proeModel.Display();
directory = session.GetCurrentDirectory();
descrModel = proeModel.GetDescr();
descrModel.SetPath(directory);
proeModel.Backup(descrModel);
System.out.println("Model was retrieved and backed up");
}
catch(jxthrowable x){
System.out.println("pfcException: " + x);
x.printStackTrace();
}
}
}
}
catch (jxthrowable x) {
System.out.println("Error initializing test program: "+x);
x.printStackTrace();
return;
}
}
/**
* J-Link stop method.
*/
public static void stop() {
System.out.println("Stopped");
}
}
/*****************************************************************************\
My problem is if I include ModelType.MDL_DRAWING it will not display or backup the drawing file I cannot see why this is not working.
Any help would be very appreciated
Thanks in advance,
Andy Ley