Web Hosting Talk







View Full Version : Is there any tool for a "server image"?


Shiva
02-14-2002, 09:16 AM
Is there any tool to create and save and/or print an image of the server structure of an account by using FTP or a Perl script (directories, files, permissions)?

allan
02-14-2002, 10:11 AM
Originally posted by Shiva
Is there any tool to create and save and/or print an image of the server structure of an account by using FTP or a Perl script (directories, files, permissions)?


You just want a listing of all files and their permissions for a particular directory and its subdirectories? Try this:

ls -Ral /directory | filename.txt

Shiva
02-14-2002, 10:30 AM
Thank you for this hint. I will use it on our UNIX machine.

But is there also a possibility to do such a listing, if there is no shell access (Telnet) possible and I have to use either FTP or a (Perl) script?

zupanm
02-14-2002, 10:46 AM
most ftp clients you can issue a ls -R command. I don't think you can pipe it to a file though. As for a perl script you can do

$list = system(ls -lsR /dir);
echo $list;

i'm sure there's a cleaner way of doing that without using a system() but i don;t know since i don't use perl anymore all that much

MIke

priyadi
02-14-2002, 12:37 PM
Originally posted by zupanm

$list = system(ls -lsR /dir);
echo $list;


That's just plain wrong. To capture the output of shell command you need to use backquote, like in `ls -lsR /dir`.

zupanm
02-14-2002, 12:55 PM
the only thing i didn't add was you have to quote a system command like system("ls -lsR /dir");

you only have to use `` if your doing a shell script. A system() will fork off a process then issue that command.

heh.. ok i noticed another mistake. its print not echo.. too much php i guess.


#!/usr/bin/perl

$list = system("ls -lsR /tmp");
print $list;

Shiva
02-14-2002, 08:30 PM
Thank you, guys, I will try it!