Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Batch FIle delete files with particular date 10 86
Need to learn promise API 2 51
Need script to search multiple files in one drive 13 44
powershell md/mkdir/New-item   -Quiet 10 38
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
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…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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…

785 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