Delete file controller
5965
public function __async_delete()
    {
        /** @var \samsonphp\fs\FileService $fsModule */
        $fsModule = $this->system->module('fs');

        /** @var \samsoncms\input\Field $field */
        $this->createField(new dbQuery(), $_GET['e'], $_GET['f'], $_GET['i']);

        // Build uploaded file path
        $file = $this->field->value();

        // Delete thumbnails
        if (class_exists('\samson\scale\ScaleController', false) && $this->isImage($fsModule->extension($file))) {

            /** @var string $path Path to file */
            $path = '';

            // Get file path
            preg_match('/.*\//', $file, $path);
            $path = $path[0];

            // Get image src
            $src = substr($file, strlen($path));

            /** @var \samson\scale\ScaleController $scale */
            $scale = m('scale');

            foreach (array_keys($scale->thumnails_sizes) as $folder) {
                // Form image path for scale module
                $imageScalePath = $path . $folder . '/' . $src;
                if ($fsModule->exists($imageScalePath)) {
                    $fsModule->delete($imageScalePath);
                }
            }
        }

        if ($fsModule->exists($file)) {
            $fsModule->delete($file);
        }
        
        // TODO Save empty field value
        $this->field->save(' ');

        return array('status'=>true);
    }
279667
def delete_file(f):
    
    fp = f.get_fullpath()
    log.info("Deleting file %s", fp)
    os.remove(fp)
558340
def _delete_file(configurator, path):
    
    path = os.path.join(configurator.target_directory, path)
    os.remove(path)
    try:
        os.removedirs(os.path.dirname(path))
    except OSError:
        pass
60552
def delete(self):
        
        urls = self.selected_urls()
        rep = QtWidgets.QMessageBox.question(
            self.tree_view, _('Confirm delete'),
            _('Are you sure about deleting the selected files/directories?'),
            QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
            QtWidgets.QMessageBox.Yes)
        if rep == QtWidgets.QMessageBox.Yes:
            deleted_files = []
            for fn in urls:
                try:
                    if os.path.isfile(fn):
                        os.remove(fn)
                        deleted_files.append(fn)
                    else:
                        files = self._get_files(fn)
                        shutil.rmtree(fn)
                        deleted_files += files
                except OSError as e:
                    QtWidgets.QMessageBox.warning(
                        self.tree_view, _('Delete failed'),
                        _('Failed to remove "%s".\n\n%s') % (fn, str(e)))
                    _logger().exception('failed to remove %s', fn)
            self.tree_view.files_deleted.emit(deleted_files)
            for d in deleted_files:
                debug('%s removed', d)
                self.tree_view.file_deleted.emit(os.path.normpath(d))
18494
def delete_file(self, file_id, file_etag=None):
		''''''
		return self( join('files', bytes(file_id)), method='delete',
			headers={'If-Match': file_etag} if file_etag else dict() )
996213
private AFTPClient actionRemoveDir() throws IOException, PageException {
	required("directory", directory);

	AFTPClient client = getClient();
	if (recursive) {
	    removeRecursive(client, directory, FTPFile.DIRECTORY_TYPE);
	}
	else client.removeDirectory(directory);

	writeCfftp(client);
	return client;
    }
713702
def unregister_controllers(self):
        
        # TODO(xpconanfan): actually record these errors instead of just
        # logging them.
        for name, module in self._controller_modules.items():
            logging.debug('Destroying %s.', name)
            with expects.expect_no_raises(
                    'Exception occurred destroying %s.' % name):
                module.destroy(self._controller_objects[name])
        self._controller_objects = collections.OrderedDict()
        self._controller_modules = {}
155905
def delete(method, hmc, uri, uri_parms, logon_required):
        """"""
        try:
            adapter = hmc.lookup_by_uri(uri)
        except KeyError:
            raise InvalidResourceError(method, uri)
        cpc = adapter.manager.parent
        assert cpc.dpm_enabled
        adapter.manager.remove(adapter.oid)
1368292
function clear() {
		$Finder = new \FilesystemIterator($this->dirname,
			\FilesystemIterator::KEY_AS_FILENAME
			| \FilesystemIterator::CURRENT_AS_FILEINFO
			| \FilesystemIterator::SKIP_DOTS);
		foreach ( $Finder as $key => $value ) {
			if ( pathinfo($key,PATHINFO_EXTENSION)=='json' ) {
				unlink($value->getRealPath());
			}
		}
	}
203965
def delete_gallery_file(self, file_id, scope='content/write'):
        
        return _delete(
            token=self.oauth.get_user_token(scope),
            uri='/user/media/file/' + urllib.quote(file_id)
        )
1257907
def remove_file(self, name):
        """"""
        assert compat.is_native(name)
        self.check_write(name)
        # self.cur_dir_meta.remove(name)
        self.ftp.delete(name)
        self.remove_sync_info(name)
1210071
function() {
        var items = _utils.getArgArray(arguments);
        if (items.length === 0) {
            throw new Error('no files specified to clean up');
        }
        items.forEach(function(item) {
            try {
                var path = (typeof item === 'string') ? item : item.path;
                _fs.unlinkSync(path);
            } catch (e) {
                // Eat the exception.
            }
        });
    }
594045
def delete_config_dir
      begin
        FileUtils.rm_r(config_dir) if dir_exists?

      rescue StandardError => e
        raise FileAccessError, e.message
      end
    end
609566
function () {

            var that = this;
            var now = +new Date();
            var toRemove = _(this.controllers).filter(function (c) {
                var age = (now - c.lastView);
                return (age > 60000); // Keep in cache for 1 minute.
            });

            _(toRemove).each(function (c) {
                if (c.controller !== that.currentController) {
                    delete that.controllers[c.pageUID];
                    c.controller.destroy();
                    if (c.controller._rootView) {
                        c.controller._rootView.clean();
                        c.controller._rootView.remove();
                        Jackbone.trigger("destroyview", c.controller._rootView);
                    }
                }
            });
        }
256497
def remove(self, force=False):
        
        if force:
            _fs, filename = opener.parse(self.uri)
            _fs.remove(filename)
        self.uri = None
902096
def remove(self):
        """"""
        if self.exists() or self.islink():
            self.fs.unlink(self.get_internal_path())
            return 1
        return None
753518
public function remove()
    {

        $origin = $destination = \Devil::getPathOf($this->config['dest']);
        if (isset($this->config['onload'])) {
            $destination .= '/origin';
        }
        $realFileName = $destination . '/' . $this->_primaryKey . '_' . $this->existing;
        if (file_exists($realFileName)) unlink($realFileName);

        if (isset($this->config['onload'])) foreach ($this->config['onload'] as $method=>$config) {
            $methodRemove = $method . 'Remove';
            $this->$methodRemove($origin, $this->_primaryKey . '_' . $this->existing, $config);
        }
    }