Solved

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

Posted on 2007-03-22
4
171 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

756 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