From 65288bcfc14b16d79ccfa0f0d5f0ad3f6e05d4f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Carretero?=
 <frederic.carretero@veremes.com>
Date: Wed, 14 Nov 2018 14:54:25 +0100
Subject: [PATCH] =?UTF-8?q?getDirectoryFiles()=20->=20Retourne=20la=20list?=
 =?UTF-8?q?e=20de=20tous=20les=20fichiers=20d'un=20r=C3=A9pertoire.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 vas/rest/class/vmlib/phpUtil.inc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/vas/rest/class/vmlib/phpUtil.inc b/vas/rest/class/vmlib/phpUtil.inc
index 9cc1a4ee..9367e187 100755
--- a/vas/rest/class/vmlib/phpUtil.inc
+++ b/vas/rest/class/vmlib/phpUtil.inc
@@ -1534,4 +1534,21 @@ function uploadFileToLocal($sNomObjet, $sFileType, $sServerPath, $sMaxSize) {
 
     return $sErrorMsg;
 }
+
+/**
+ * Get all the files of a directory
+ * @param string $sDirectoryPath
+ * \return array
+ */
+function getDirectoryFiles($sDirectoryPath) {
+    $aFiles = array();
+    if (file_exists($sDirectoryPath) && is_dir($sDirectoryPath)) {
+        $oIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($sDirectoryPath));
+        foreach ($oIterator as $oFileinfo) {
+            if (!$oFileinfo->isDir())
+                $aFiles[] = $oFileinfo->getPathname();
+        }
+    }
+    return $aFiles;
+}
 ?>
-- 
GitLab