Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-03-22
4
Medium Priority
?
176 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

688 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