Linked Questions

-1 votes
1 answer
286 views

I am trying to use php to check if a directory is empty or not. I have seen a lot of similar questions but I have not been able to solve the problem. Namely, the following code always gives me the ...
Midhat's user avatar
  • 55
0 votes
1 answer
257 views

I would like to know how to show a small message when I use the Scandir function to show files of a folder,in place of a link if this folder is empty... I show you the code : <div class="...
Emrys's user avatar
  • 1
7 votes
4 answers
14k views

I have some image files in public/image directory, so I want to determine if a file exist in that directory before I save a new file. How to determine if a file exist?
Misterk's user avatar
  • 693
4 votes
1 answer
4k views

I've got a folder, filled with both empty and full folders. I want to iterate over all of them, figure out if they are empty, and if so, remove them. I've seen some questions that are appliccable, ...
chocolata's user avatar
  • 3,358
1 vote
1 answer
2k views

On Stack Overflow there are several answers to the question of how to check if the directory is empty, but which is the fastest, which way is the most effective? Answer 1: https://stackoverflow.com/a/...
PeraMika's user avatar
  • 3,688
0 votes
1 answer
2k views

I asked this question for PHP a long time ago. The same applies for Node.js the code below seems a little slow when using in a loop - is there a way for writing this in pure Node.js vanilla JavaScript ...
TheBlackBenzKid's user avatar
1 vote
1 answer
946 views

I want to check if a folder has at least 1 file. I am now using this to check if a folder is empty but this also checks if there is a subfolder in it. if (count(glob($dir.'/*')) === 0 ) {} And I ...
Jack Maessen's user avatar
  • 1,867
0 votes
2 answers
833 views

im trying to echo all jpg image files in a folder. it works, but i dont have the line to show an error that the folder is empty written properly. it shows a php script error instead, another problem ...
user2579331's user avatar
0 votes
0 answers
601 views

I am currently using the following piece of code to ZIP the current folder: <?php $rootPath = realpath('./'); $zip = new ZipArchive(); $zip->open('archive.zip', ZipArchive::CREATE | ...
Peter's user avatar
  • 51
1 vote
1 answer
479 views

I've reviewed a number of ways to determine that a directory is empty or not, and many indicate that $isDirEmpty = !(new \FilesystemIterator($dir))->valid(); is a good choice, except that the ...
user avatar
-2 votes
1 answer
215 views

I'm creating a cron job that will autoflush the tmp directory everyday to make sure the tmp directory is not flooded with unwanted files. However i want to delete all files and folders in the tmp ...
Akshay Shrivastav's user avatar
0 votes
2 answers
146 views

I would like to check if the folder is empty or not. I tried $files!=0 but it doesn't work,because the print_r($files); shows this: Array ( [0] => . [1] => .. ) How to write the right condition? ...
darksoul90's user avatar
-2 votes
1 answer
69 views

I have a bit of a problem. I am putting up a profile picture on my system where the pictures are stored in a file and I'm calling it from the database. What I want to happen is this: For person who ...
TheTruth's user avatar