Solved

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

Posted on 2007-03-22
4
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

632 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