Page 298 - CITS - CSA - TP (Volume 1) - Hindi
P. 298

कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS


























           III  डायरे री और उसके  कं ट ट को िडलीट करना
              1  टे  एिडटर ओपन कर

              2  िन  कोड िलख

                              <html>
                              <body>

                            <?php

               $directory_path = ‘example_directory ;

                  // Check if the directory exists before attempting to delete
                  if (is_dir($directory_path))

                  {

                            // Open the directory

                            $directory_handle = opendir($directory_path);
                            // Iterate over the contents and delete files and subdirectories

                           while (($file = readdir($directory_handle)) !== false)

                                   {
                                  if ($file != “.” && $file != “..”)

                                {

                                           // Delete files and subdirectories
                                           unlink($directory_path . ‘/  . $file);

                                 }

                            }

                            // Close the directory handle
                            closedir($directory_handle);

                            // Delete the directory itself



                                                           282

                                      CITS : IT & ITES - कं  ूटर सॉ वेयर ए ीके शन - अ ास 55
   293   294   295   296   297   298   299   300   301   302   303