By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,505 Members | 1,168 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,505 IT Pros & Developers. It's quick & easy.

File System Mangement

P: n/a
Hello.. I am trying to make a filesystem management script.
I want to display a list of files and directories and be able to delete them
from this list....
I made a search on the net and there are loads of them but I am trying to do
something much more simple.

At the moment I can display everything within a folder but if I click on a
directory it won't go into the directory, listing all contents ... it is
just a link.

Does anyone know any Tutorial page or if there is any function for
directories navigation ?

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Thu, 30 Jun 2005 12:53:20 +0000, Angelos wrote:
Hello.. I am trying to make a filesystem management script. I want to
display a list of files and directories and be able to delete them from
this list....
I made a search on the net and there are loads of them but I am trying to
do something much more simple.

At the moment I can display everything within a folder but if I click on a
directory it won't go into the directory, listing all contents ... it is
just a link.

Does anyone know any Tutorial page or if there is any function for
directories navigation ?


You mean the

bool chdir(path);

function.

Example from the manual,

// current directory
echo getcwd() . "\n";

chdir('public_html');

// current directory
echo getcwd() . "\n";
But that isn't what you want to know really. What you really want to know
for your application is how to collect directories and files, you don't
need to change directory to collect those.

Three methods,

The first is preferred for speed when collection has to be at the time
your code is ran. It collects as needed. So as your code looks in each
directory it collects the file information you want, acts on it in what
ever way your application needs, but goes no further until it is told, as
in browsing say or triggered from code, but not a continuous collection
process.
The second, and worst of the three, is a full collection process at the
time your code is ran. Try that on your ISP's site and they are likely to
send the boys round to see you.

Last, if you do need a full system tree/file list then consider doing this
outside of your script. A cron job in c/c++/perl ... You could have it as
a plain text file of directories that your code can use, or have it update
a MySQL database. Then it's all available for use in a similar way to
'locate' database.

The way I see it, if you have an overnight script going to all the trouble
of collecting dirs/files then it might as well pick out other information
ready for quick use in utility code, to save having it go and look at the
file itself, if your application allows.

So a suggestion for fields might be,

ID
dirpath - Directory path
filename - file name
type - File type
size - file size
created - created date
accessed - accessed date
owner - Owner
backupname - I used a name modifier for versions of documents. In my case
I make use of the year-week number - week day information of the time it
was last changed.

Jul 17 '05 #2

P: n/a
>> Does anyone know any Tutorial page or if there is any function for
directories navigation ?


You mean the

bool chdir(path);

function.


I don't know if that will help, but anyway thanks for your reply...

I'll have a look at these in a bit ;-)
Thanks a lot
Jul 17 '05 #3

P: n/a
Hi!
Hello.. I am trying to make a filesystem management script.
I want to display a list of files and directories and be able to delete them
from this list....
I made a search on the net and there are loads of them but I am trying to do
something much more simple.

At the moment I can display everything within a folder but if I click on a
directory it won't go into the directory, listing all contents ... it is
just a link.


I found such a script on my HD, here it is:
http://nopaste.php-q.net/144412

HTH
Hero Wanders
Jul 17 '05 #4

P: n/a
> I found such a script on my HD, here it is:
http://nopaste.php-q.net/144412


man this script is great ... know the only thing I have to do is some how to
restrict access to all directories except the specified....
It shouldn't be difficult... ;-)
Thanks again !!!
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.