how to find the number of files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to find the number of files
Prev   Next
# 1  
Old 10-05-2007
how to find the number of files

hi,

1) I want to find from the current directory the number of files (count) with two or more particular extentions in another directory.

For ex: If I am in a/b/c directory... I want to find the count of the files with .txt and .dat extention in a/d/e directory. I have tried using the below one:

a/b/c> ls a/d/e/*.txt *.dat | wc -l --- this is not working.. Please help.

2) In the above directory a/d/e, i want to get the name of the last file with extention *.dat-- how to get it

Thanks in advance,
Harish
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to count number of files in directory and write to new file with number of files and their name?

Hi! I just want to count number of files in a directory, and write to new text file, with number of files and their name output should look like this,, assume that below one is a new file created by script Number of files in directory = 25 1. a.txt 2. abc.txt 3. asd.dat... (20 Replies)
Discussion started by: Akshay Hegde
20 Replies

2. Shell Programming and Scripting

Bash script to find the number of files and identify which ones are 0 bytes.

I am writing a bash script to find out all the files in a directory which are empty. I am running into multiple issues. I will really appreciate if someone can please help me. #!/bin/bash DATE=$(date +%m%d%y) TIME=$(date +%H%M) DIR="/home/statsetl/input/civil/test" ... (1 Reply)
Discussion started by: monasharma13
1 Replies

3. Shell Programming and Scripting

Using find in a directory containing large number of files

Hi All, I have searched this forum for related posts but could not find one that fits mine. I have a shell script which removes all the XML tags including the text inside the tags from some 4 million XML files. The shell script looks like this (MODIFIED): find . "*.xml" -print | while read... (6 Replies)
Discussion started by: shoaibjameel123
6 Replies

4. Shell Programming and Scripting

Find the number of files older than 1 day from a dir

Hello All, I need to write a script/command which can find out the number of .csv files residing in a directory older than 1 day. The output should come with datewise (means for each date how many files are there). I've this command, but this command gives the total number of files. It's... (10 Replies)
Discussion started by: NARESH1302
10 Replies

5. Shell Programming and Scripting

how can i find number of lines in files & subdirectories

how can i find number of lines in files & subdirectories ? (3 Replies)
Discussion started by: pcbuilder
3 Replies

6. Shell Programming and Scripting

Find the user with less number of files in the system

Good morning everybody, I'm using Minix and I want to find the user with less number of files in the system I have tried this solution: #! /bin/sh indice=0 listaCut=$(cut -f 3 -d : /etc/passwd) for USER in $listaCut; do cont=0 listaFind=$(find / -user "${USER}" -type -f) ... (4 Replies)
Discussion started by: Guccio
4 Replies

7. UNIX for Dummies Questions & Answers

Problem using find with prune on large number of files

Hi all; I'm having a problem when want to list a large number of files in current directory using find together with the prune option. First i used this command but it list all the files including those in sub directories: find . -name "*.dat" | xargs ls -ltr Then i modified the command... (2 Replies)
Discussion started by: ashikin_8119
2 Replies

8. Shell Programming and Scripting

How to do a find number of files in awk

Hi, How can i able to do a similar operation to "find" number of files in a folder in an awk? In bash, we could do easily using "find" command. But currently, I am having an awk block and i wanted to extract these information. Please advise. Thanks. (2 Replies)
Discussion started by: ahjiefreak
2 Replies

9. Shell Programming and Scripting

script to find the average number or files?

Anyone has a script or command in UNIX that can take 4 to five different numbers and calculate the average? (2 Replies)
Discussion started by: bbbngowc
2 Replies

10. Shell Programming and Scripting

awk script to find the number of files

awk script to find the number of files in a directory with their date less than 15-oct-2006 please help (4 Replies)
Discussion started by: uni_ajay_r
4 Replies
Login or Register to Ask a Question
LDAP_GET_ATTRIBUTES(3)							 1						    LDAP_GET_ATTRIBUTES(3)

ldap_get_attributes - Get attributes from a search result entry

SYNOPSIS
array ldap_get_attributes (resource $link_identifier, resource $result_entry_identifier) DESCRIPTION
Reads attributes and values from an entry in the search result. Having located a specific entry in the directory, you can find out what information is held for that entry by using this call. You would use this call for an application which "browses" directory entries and/or where you do not know the structure of the directory entries. In many applications you will be searching for a specific attribute such as an email address or a surname, and won't care what other data is held. return_value["count"] = number of attributes in the entry return_value[0] = first attribute return_value[n] = nth attribute return_value["attribute"]["count"] = number of values for attribute return_value["attribute"][0] = first value of the attribute return_value["attribute"][i] = (i+1)th value of the attribute PARAMETERS
o $link_identifier - An LDAP link identifier, returned by ldap_connect(3). o $result_entry_identifier - RETURN VALUES
Returns a complete entry information in a multi-dimensional array on success and FALSE on error. EXAMPLES
Example #1 Show the list of attributes held for a particular directory entry <?php // $ds is the link identifier for the directory // $sr is a valid search result from a prior call to // one of the ldap directory search calls $entry = ldap_first_entry($ds, $sr); $attrs = ldap_get_attributes($ds, $entry); echo $attrs["count"] . " attributes held for this entry:<p>"; for ($i=0; $i < $attrs["count"]; $i++) { echo $attrs[$i] . "<br />"; } ?> SEE ALSO
ldap_first_attribute(3), ldap_next_attribute(3). PHP Documentation Group LDAP_GET_ATTRIBUTES(3)