(поиск одинаковых файлов – дубликатов)

installing fdupes:

apt install fdupes

yum install fdupes

 

running search of the duplicated files in the specified directory and writing the result to the file /home/user/dir/duplicates.txt:

its better to run in screen as it is long process:

screen -S fdupes

fdupes -r /home/user/dir > /home/user/dir/duplicates.txt

It will be upload files of any type in folder $uploaddir:

<!DOCTYPE HTML>
<HTML>
  <HEAD>
    <meta charset="utf-8">
    <title>upload</title>
  </HEAD>
  <BODY>
    <h1>Upload file service</h1>
    <hr>
<?php
$uploaddir = './files/';


if(isset($_FILES['userfile'])){
    foreach ($_FILES['userfile']['name'] as $key => $value) {
        echo "<b>".$value."</b>";
        $uploadfile = $uploaddir.basename($_FILES['userfile']['name'][$key]);
        if (copy($_FILES['userfile']['tmp_name'][$key], $uploadfile)){
            echo "OK<br>";
        }
        else {
            echo "Error";
            //exit;
        }
        echo "<p><b>Name</b>: ".$_FILES['userfile']['name'][$key]."</p>";
        echo "<p><b>Mime-type</b>: ".$_FILES['userfile']['type'][$key]."</p>";
        echo "<p><b>Size</b>: ".$_FILES['userfile']['size'][$key]."</p>";
        echo "<p><b>TMP Name</b>: ".$_FILES['userfile']['tmp_name'][$key]."</p>";
        echo "<hr>";
    }
}
?>
    <form method="post" enctype="multipart/form-data">
      <input type="file" name="userfile[]" multiple="true">
      <input type="submit" value="upload">
    </form>
  </BODY>
</HTML>