Index: /trunk/src/pvo-FITS-fileIO.cc
===================================================================
--- /trunk/src/pvo-FITS-fileIO.cc	(revision 134)
+++ /trunk/src/pvo-FITS-fileIO.cc	(revision 135)
@@ -126,5 +126,5 @@
       if(this->writingData){
 
-	if(this->newFile && this->fileExists()){
+	if(this->newFile && this->fileExists() && !this->clobber){
 	  std::stringstream errmsg;
 	  errmsg << "\aThe file "<< this->getFITSname() 
Index: /trunk/src/pvo-FITS.cc
===================================================================
--- /trunk/src/pvo-FITS.cc	(revision 134)
+++ /trunk/src/pvo-FITS.cc	(revision 135)
@@ -27,4 +27,5 @@
       this->verbose = true;
       this->writingData = true;
+      this->clobber = false;
     }
     //-----------------------------------------------------------------------
@@ -273,11 +274,18 @@
        */
       int status = 0, exists;
-      fits_file_exists((char *)name.c_str(),&exists,&status);
-      if(status) this->FITSError("PSRFits::openFile 1",status);
-      status=0;
-      if(exists<=0){
-	if(iomode==READWRITE){
+      std::string fitsname = name;
+      if(this->clobber){
+	exists=0;  // pretend for the next bit that it doesn't exist.
+	fitsname = "!" + name;
+      }
+      else{
+	fits_file_exists((char *)name.c_str(),&exists,&status);
+	if(status) this->FITSError("PSRFits::openFile 1",status);
+	status=0;
+      }
+      if(exists<=0){ // File does not exist.
+	if(iomode==READWRITE){ // create it.
 	  char *template_file = (char *)getPSRFITSdefn().c_str();
-	  fits_create_template(&this->fptr, (char *)name.c_str(), 
+	  fits_create_template(&this->fptr, (char *)fitsname.c_str(), 
 			       template_file, &status);
 	  if(status) this->FITSError("PSRFits::openFile 2",status);
@@ -285,5 +293,5 @@
 	  this->newFile = true;
 	}
-	else{
+	else if(!this->clobber){ // it *really* does not exist and we need it to
 	  std::stringstream errmsg;
 	  errmsg << name << " does not exist.\n";
@@ -292,5 +300,5 @@
 	}
       }
-      else{
+      else{ // open the file.
 	fits_open_file(&this->fptr, name.c_str(), iomode, &status);
 	if(status) this->FITSError("PSRFits::openFile 2",status);
Index: /trunk/src/pvo-FITS.hh
===================================================================
--- /trunk/src/pvo-FITS.hh	(revision 134)
+++ /trunk/src/pvo-FITS.hh	(revision 135)
@@ -163,9 +163,12 @@
       void        setFilestate(STATE S){filestate=S;};
 
+      bool        clobberFile(){return clobber;};
+      void        setClobber(bool b){clobber = b;};
+
       /** Are we writing data to the FITS file? */
-      bool areWritingData(){return writingData;};
+      bool       areWritingData(){return writingData;};
 
       /** Define whether we are writing data to the FITS file. */
-      void setWritingData(bool b){writingData=b;};
+      void       setWritingData(bool b){writingData=b;};
 
       /** Get the UT of the first observations in the input file. */
@@ -297,4 +300,5 @@
       fitsfile *fptr;           ///< The CFITSIO file variable
       std::string FITSname;     ///< The output FITS filename
+      bool clobber;             ///< Shall we overwrite an existing file?
       bool newFile;             ///< Is the file a new one?
       STATE filestate;          ///< OPEN or CLOSED?
Index: /trunk/src/pvo.hh
===================================================================
--- /trunk/src/pvo.hh	(revision 134)
+++ /trunk/src/pvo.hh	(revision 135)
@@ -27,4 +27,6 @@
 "Usage: pvoconvert [options] <survey file(s)> ...\n\
   Running options:\n\
+  -c                Clobber: overwrite files if they exist\n\
+  --clobber           (default is to exit if a file exists)\n\
   -D <dir>          Run pvoconvert on all files in the stated directory.\n\
   --directory <dir>\n\
@@ -58,4 +60,6 @@
 "Usage: pvoconvert [options] <survey file(s)> ...\n\
   Running options:\n\
+  -c                Clobber: overwrite files if they exist\n\
+  --clobber           (default is to exit if a file exists)\n\
   -D <dir>          Run pvoconvert on all files in the stated directory.\n\
   --directory <dir>\n\
Index: /trunk/src/pvoconvert.cc
===================================================================
--- /trunk/src/pvoconvert.cc	(revision 134)
+++ /trunk/src/pvoconvert.cc	(revision 135)
@@ -57,4 +57,5 @@
   bool usingHighLatitude = false;
   bool writingData = true;
+  bool clobberFlag = false;
   unsigned int i;
 
@@ -68,14 +69,15 @@
     int option_index = 0;
     static struct option long_options[] = {
+      {"clobber", 0, 0, 'c'},
       {"help", 0, 0, 'h'},
       {"highlat", 0, 0, 'H'},
       {"directory", 1, 0, 'D'},
-      {"test", 1, 0, 't'},
-      {"verbose", 1, 0, 'V'},
-      {"version", 1, 0, 'v'},
+      {"test", 0, 0, 't'},
+      {"verbose", 0, 0, 'V'},
+      {"version", 0, 0, 'v'},
       {0, 0, 0, 0}
     };
 
-    c = getopt_long (argc, argv, "D:HVvht",
+    c = getopt_long (argc, argv, "D:HVvhtc",
 		     long_options, &option_index);
 
@@ -119,4 +121,7 @@
       return 0;
       break;
+    case 'c': // clobber files
+      clobberFlag = true;
+      break;
     case 'H': // High Latitude survey
       usingHighLatitude = true;
@@ -202,4 +207,5 @@
       fitsfile.setWritingData(writingData);
       fitsfile.setVerbosity(verbFlag);
+      fitsfile.setClobber(clobberFlag);
       //      fitsfile.setOldFilename(fname);
       fitsfile.setCommandLine(argv[0],fname);
