Delete orphaned files, but requires user confirmation to ensure delete process.
553190
public function actionCleanup()
    {
        $fileList = StorageImporter::getOrphanedFileList();

        if ($fileList === false) {
            return $this->outputError("Could not find the storage folder to clean up.");
        }
        
        if (count($fileList) > 0) {
            foreach ($fileList as $fileName) {
                $this->output($fileName);
            }
            $this->outputInfo(count($fileList) . " files to remove.");
        }

        if (count($fileList) !== 0) {
            $success = true;
            if ($this->confirm("Do you want to delete " . count($fileList) . " files which are not referenced in the database any more? (can not be undon, maybe create a backup first!)")) {
                foreach ($fileList as $file) {
                    if (is_file($file) && @unlink($file)) {
                        $this->outputSuccess($file . " successful deleted.");
                    } elseif (is_file($file)) {
                        $this->outputError($file . " could not be deleted!");
                        $success = false;
                    } else {
                        $this->outputError($file . " could not be found!");
                        $success = false;
                    }
                }
            }
            if ($success) {
                return $this->outputSuccess(count($fileList) . " files successful deleted.");
            }
            return $this->outputError("Cleanup could not be completed. Please look into error above.");
        }
        
        return $this->outputSuccess("No orphaned files found.");
    }
296301
def cleanup(self):
        """"""
        for file in glob.glob(self.basename + '*'):
            os.unlink(file)
630916
private void cleanUp() {
        try {
            File file = new File(System.getProperty("user.dir"));
            String[] links = file.list();
            for (String name : links) {
                File potentialSymLink = new File(file, name);
                if (FileUtils.isSymlink(potentialSymLink)) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("DELETING: " + potentialSymLink);
                    }
                    potentialSymLink.delete();
                }
            }
        }
        catch (Exception e) {
            logger.warn("Failed to remove symlinks", e);
        }
    }
498724
def delete_files(self, ids):
        """"""

        self.check_owner()
        if not isinstance(ids, list):
            raise TypeError("You must specify list of files to delete!")
        self.conn.make_call("deleteFiles", ids)
1253262
protected function deleteFile()
    {
        $this->controlAccess('file_delete');

        if ($this->file->deleteAll($this->data_file['file_id'])) {
            $this->redirect('admin/content/file', $this->text('File has been deleted from database and disk'), 'success');
        }

        // Redirect in any case as file can be already deleted from the database
        $this->redirect('admin/content/file', $this->text('An error occurred'), 'warning');
    }
1310493
public function remove_files() {
        $fs = get_file_storage();
        $files = $fs->get_external_files($this->id);
        foreach ($files as $storedfile) {
            $storedfile->delete();
        }
    }
1013233
def delete_files(sender, **kwargs):
    """"""
    instance = kwargs['instance']

    if not hasattr(instance.distribution, 'path'):
        return

    if not os.path.exists(instance.distribution.path):
        return

    # Check if there are other instances which reference this fle
    is_referenced = (
        instance.__class__.objects
        .filter(distribution=instance.distribution)
        .exclude(pk=instance._get_pk_val())
        .exists())
    if is_referenced:
        return

    try:
        instance.distribution.storage.delete(instance.distribution.path)
    except Exception:
        logger.exception(
            'Error when trying to delete file %s of package %s:' % (
                instance.pk, instance.distribution.path))
765993
def _cleanup_ca_temp_file(self):
        
        if os.name == 'nt':
            if isinstance(self.ca_verify_filename, (binary_type, text_type)):
                # windows requires file to be closed for access. Have to manually remove
                os.unlink(self.ca_verify_filename)
        else:
            # other OS's allow close and delete of file.
            self._ca_verify_file_handle.close()
1210629
public function cleanup()
    {
        if ($this->option('force')) {
            $this->deleteDirs();
        } elseif ($this->confirm('Delete all subdirectories in migrations folder?', true)) {
            $this->deleteDirs();
        }
    }
1110418
def remove_file(self):
        """"""
        if not self.fullpath or not self.archived:
            raise RuntimeError("""Can't remove a non-archived data product""")
        try:
            os.remove(self.fullpath)
        except:
            print("Error removing %s: %s" % (self.fullpath, sys.exc_info()[1]))
197824
def handle_delete(self):
        """"""
        from intranet.apps.eighth.models import EighthScheduledActivity
        EighthScheduledActivity.objects.filter(eighthsignup_set__user=self).update(
            archived_member_count=F('archived_member_count')+1)
1364413
function removePofile(done) {
            if (!self.userDir) return done(null);

            rimraf(self.userDir, done);
        }
615730
def delete(self):
        
        self.room.check_owner()
        self.conn.make_call("deleteFiles", [self.fid])
271799
void deleteNewAndOldFiles() {

        fa.removeElement(fileName + ".data" + ".old");
        fa.removeElement(fileName + ".data" + ".new");
        fa.removeElement(fileName + ".backup" + ".new");
        fa.removeElement(scriptFileName + ".new");
    }
1134580
def delete(self, raise_exc=True, headers=None, files=None):
        ''''''

        return self._request(DELETE, None, raise_exc, headers, files)
68436
def cleanup_on_delete(self, sender, document, **kwargs):
        '''
        
        '''
        if not self.follow or sender is not self.owner_document:
            return
        slug = getattr(document, self.db_field)
        namespace = self.owner_document.__name__
        SlugFollow.objects(namespace=namespace, new_slug=slug).delete()
1080166
function onRemove( error ) {
		if ( error ) {
			debug( 'Error encountered while attempting to delete a temporary input file %s: %s', inFile, error.message );
			return done( error );
		}
		debug( 'Successfully deleted temporary input file: %s', inFile );
		if ( dest === void 0 ) {
			debug( 'Reading temporary output file: %s', outFile );
			return readFile( outFile, {'encoding':'utf8'}, onFile );
		}
		done();
	}