Programming Forums
User Name Password Register

RSS Feed

Thread Tools Display Modes
Old Oct 10th, 2015, 12:49 AM   #1
Hobbyist Programmer
Join Date: Jan 2011
Posts: 115
Rep Power: 8 darkranger85 is on a distinguished road
Looking for a little help: Scanning all files and directories

Ok, first off, I do not want to be given a fully working script. I am trying to exercise my coding abilities.

I'm trying to write a script that will scan every file and directory on a domain and store them in arrays, the files along side their last modified timestamp.

Here is what I've put together so far. I know it's flawed and far from finished.

$results = scandir($_SERVER['DOCUMENT_ROOT']);
	$dirs = array();
	$files = array();

	function fileSort($data){

		if (is_dir($data)) {
			$dirs[] = $data;
		} else if (is_file($data)) {
			$files[] = $data;

		return array($dirs, $files);

	}//END fileSort

	function pathing($results){

		foreach ($results as $result) {
			if ($result === '.' OR $result === '..') {
			} else {				
			}//END if Statement		
		}//END foreach



I appreciate any input!
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along wound destroy civilization." -Gerald Weinberg
darkranger85 is offline   Reply With Quote
Old Oct 12th, 2015, 3:20 AM   #2
Join Date: May 2009
Location: The Netherlands
Posts: 251
Rep Power: 9 pritaeas is on a distinguished road
Re: Looking for a little help: Scanning all files and directories

It's a start, but if you're interested in a little more modern solution, have a look at this class:
pritaeas is offline   Reply With Quote



« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursively rename some files name mail4mz Bash / Shell Scripting 1 Jul 12th, 2011 12:32 AM
How to store files/directories in different different directories!! anishkumarv Bash / Shell Scripting 0 Mar 23rd, 2011 6:49 PM
Delete specific Files using Cmd scripting jaacmmason Other Programming Languages 3 Apr 15th, 2010 3:28 PM
Can JSP Access .jar files? ssrun Java 2 May 29th, 2007 1:43 PM
copying files rwm C++ 8 Apr 26th, 2007 3:39 AM

DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC