How can remove many files

Website URL

(please specify the URL of the site on which you are experiencing the problem)
sebul.sarang.net

I upload many files to server with filezilla. diretory name is w.
Now I want these files.
I try deleting these files with filezilla. But it takes a lot of time.
How can delete many files quickly?
Is there another tool?
For example ssh etc…

Hi Sebuls,

???

If you want to remove the files quickly, you can use PHP script to delete then hit the server once via a HTTP request.

Not possible, too high privilege for free hosting, opens a loophole for abuse, won’t happen.

Your best chance is to delete using FTP or via file manager.

Cheers!

2 Likes

@chiucs123
Thank your comment.
i want delete sebul.sarang.net/w/ directory.
I try this work with filezilla but speed is not fast.
How can use php script? Detail please…

Create a PHP file with the following content:

nuker.php (any filename of your choice)
<?php

error_reporting(E_ALL);
header('content-type: text/plain');

function getFilesAndFolders($directory = '.') {
    $allFiles = [];
    $allFolders = [];

    // Iterate over the contents of the directory
    foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $item) {
        // Skip '.' and '..' directories
		$basename = $item->getBasename();
        if ($item->isDir() || in_array($basename, ['.', '..'], true)) {
			if($basename === '.'){
				$allFolders[] = rtrim($item->getPathname(), '.');
			}
        } elseif ($item->isFile()) {
			$allFiles[] = $item->getPathname();
        }
    }

    return ['files' => $allFiles, 'folders' => $allFolders];
}

// Replace '.' with the path of the directory you want to start from
$result = getFilesAndFolders(__DIR__);

echo "All Files:\n";
print_r($result['files']);
foreach($result['files'] as $file){
	if(file_exists($file)){
		unlink($file);
	}
}

echo "\nAll Folders:\n";
print_r($result['folders']);

Then place this file in the w directory, and visit your website by referencing this file, for example, sebul.sarang.net/w/nuker.php, and all your files are gone by the time you see a list of files.

And yes, the nuker.php file is in that folder, so it also self-descruts. However because I’m too lazy, the only thing left for you to delete are the folders, which can be easily removed and deleted in FileZilla quickly.

Cheers!

@chiucs123 Thank you

Have you tried the online file manager too? It tends to be faster for deleting an entire folder than FileZilla.

7 Likes

@Admin online file manager very fast. Thank you very much.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.