Sponsored Content
Top Forums Shell Programming and Scripting List file in Dir and then match Post 302238560 by aliahsan81 on Saturday 20th of September 2008 05:23:07 PM
Old 09-20-2008
Data List file in Dir and then match

Hi ALL,

I am making a script that search all then worldwriteable dir in documentroot.I have manage to find all the dir now i want to match each file extension in worldwriteable against a list of array which contain file like php html etc,if i find any file then print dirname. Dont see to get any idea how i do that.i past my code for reiew and comments



#!/bin/bash

list[0]="php"
list[1]="html"
Docroot[0]="/var/www/html/"

export IFS=$'\n'

# Loop through our array.
for x in ${Docroot[@]}
do
# Find all directories & subdirectories
for i in $(find $x -type d -perm /o=w )
do



echo $i

done
done


This is a small output
/var/www/html/test3
/var/www/html/test3/abc
/var/www/html/test3/gallery
/var/www/html/test/abc
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to create new dir fro a file list

Hi, What will be the best way to do the follwing: i have a file calld dir.list /cav /cav/brif /usr/main /cat i want to run a script that will take each of the item in the file and create a new dir in a location that i'll choose it nee to do mkdir cav mkdir cav cd cav mkdir brif... (8 Replies)
Discussion started by: banjo
8 Replies

2. UNIX for Dummies Questions & Answers

Searching list of entries in file for actual files in dir

Hi all, I have a file entries.txt that contains a number of entries all on seperate lines e.g. test1 test2 test3 test4 Then in a directory called /TestFiles I have a number of files that could contain the above text in the file name e.g. qwertytest1.csv qwertytest2.csv... (2 Replies)
Discussion started by: not4google
2 Replies

3. UNIX for Dummies Questions & Answers

How to list all files in dir and sub-dir's recursively along with file size?

I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies

4. Shell Programming and Scripting

how to list of file in home dir ?

I want to print all list of file in the home dir of the user in $i with full bath an owner and group and permissions (1 Reply)
Discussion started by: testman84
1 Replies

5. UNIX for Dummies Questions & Answers

problem to determine all files and dir match up on 2 different unix boxes

Hi Friends I have 2 solaris boxes and I need to check certain directories (on local filesystem and mounted nfs) to make sure that they match up on both boxes and to delete or move the other mismatches to elsewhere on the local filesystem. I investigated for unix commands like rsync, and tree... (1 Reply)
Discussion started by: mpc8250
1 Replies

6. Shell Programming and Scripting

List all file that match user input perl

Hi, I want to list all file that match user input ( specified shell wildcard) but when I compile it dont list me #!/usr/bin/perl -w print "Enter Advance Search Function: "; chomp ($func = <STDIN>); my @files = glob("$func"); foreach my $file (@files) { print "$file\n";... (1 Reply)
Discussion started by: guidely
1 Replies

7. Shell Programming and Scripting

Create file Dir and Sub Dir same time

Hi Guys , I want create files Dire and Sub Dire. as same time using variable. EX: x1="/hk/Pt/put/NC/R1.txt" x2="/hk/pt/Put/Ot/NC/RN.txt" And i want delete all after done with my script. Thanks (2 Replies)
Discussion started by: pareshkp
2 Replies

8. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

9. Shell Programming and Scripting

Unable to list particular file in dir.

Hi i am trying to list all the file starting with CSA.CHENAISCP* i am using below command to do that ls -lrt | grep CSA.CHENAISCP*however i am getting below error. 0403-027 The parameter list is too long.please suggest me some alternative way. scriptor (3 Replies)
Discussion started by: scriptor
3 Replies

10. Shell Programming and Scripting

Rename files to match file list pattern

Hi All, I have 100 folders with the first delimiter has a unique name i.e (123_hello and 575_hello) and each folder have atlist 1000 plus files with naming convention i.e (575_hello_1.iso ... 575_hello_1000.iso). 575_hello/575_hello_1.iso 575_hello/575_hello_2.iso 575_hello/575_hello_3.iso... (8 Replies)
Discussion started by: lxdorney
8 Replies
DWWW-BUILD(8)							      Debian							     DWWW-BUILD(8)

NAME
dwww-build - build dwww index lists SYNOPSIS
dwww-build [--verbose] --default dwww-build [--verbose] html-directory DESCRIPTION
dwww-build builds the index lists of all available documents (manual pages, Info files, and so on); it should be run whenever documentation is installed or removed. dwww(7) does not work unless dwww-build has been run at least once; when the package is installed, it is run automatically. The default dwww installation creates a /etc/cron.daily/dwww, which automatically updates the pages each day. The html-directory argument specifies the directory where all the dwww HTML files will be stored. No other files should be stored there. If --default is used, the files are generated in dwww subdirectory of the directory specified in the DWWW_DOCROOTDIR variable in the /etc/dwww/dwww.conf file. (Default is /var/www/dwww.) FILES
/etc/dwww/dwww.conf Configuration file for dwww(7). FILES
/etc/dwww/dwww-user.css If such a file exists, its contents will be appended to the dwww.css file. /var/www/dwww Where all dwww HTML files are stored, if nothing else is specified. /var/lib/dwww Directory used for temporary created files. Can be overridden with the DWWW_TMPDIR variable. SEE ALSO
dwww-build-menu(8), dwww(7). AUTHOR
Lars Wirzenius. See dwww(7) for copyrights and stuff. dwww 1.11.1 February 15th, 2009 DWWW-BUILD(8)
All times are GMT -4. The time now is 09:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy