Solved

How to issue a command under all the folders of all the domains?

Posted on 2007-03-22
4
166 Views
Last Modified: 2010-04-16
Hi:

Imagine I need to run, for instance a "ls -la *.cgi" command under all the folders of all the Domains of a Linux server. Could anyone make such a small bash or perl Script to accomplish this?

In the Server, all the domains paths are so:

/var/www/html/domainname1
/var/www/html/domainname2
and so on.

Thanks a lot.

Mario./
0
Comment
Question by:multisites
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 18773887
#!/usr/bin/perl
for( grep -d,</var/www/html/*> ){
    chdir $_;
    system("ls -la *.cgi");
}
0
 
LVL 58

Accepted Solution

by:
amit_g earned 125 total points
ID: 18773895
find /var/www/html/ -name '*.cgi' -exec ls -la {} \;

or

ls -laR /var/www/html/ | grep '\.cgi$'

0
 
LVL 48

Expert Comment

by:Tintin
ID: 18775024
find /var/www/html -name "*.cgi" -ls
0
 

Author Comment

by:multisites
ID: 18775578
Great... Thanks a lot.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now