count files and subdirectories under /software


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers count files and subdirectories under /software
# 1  
Old 04-24-2011
count files and subdirectories under /software

Dear All

i need to find to total number of the files and subdirectories under /software

i issue this command

find /software/* -print | wc -l

but i need another command to know how many files and subdirectories .
# 2  
Old 04-24-2011
Why do you need another command? That one works just fine (given that software in in the root directory). I don't even use the -l.

Here's one I came up with before learning the one you mentioned:

Code:
ls -1aR \!* | egrep '[^\.]' | egrep '[^:]$' | wc -l

Depending on your shell, you may or may not need to escape the $. And you can edit that to display just directories or just files, too.

Last edited by Zucriy Amsuna; 04-24-2011 at 11:39 AM..
# 3  
Old 04-24-2011
this directories have a corrupted files and when i use find command the corrupted files not counted for that i need another command to count all files - fine and corrupted files -
# 4  
Old 04-24-2011
See my above post, in case you'll miss it.

Also, that \!* can be replaced by any directory if you use that line in a command line; I set it up as a csh alias. \!* allows an argument.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

2. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

3. Shell Programming and Scripting

Unzip all the files with subdirectories present and append a part of string from the main .zip files

Hi frnds, My requirement is I have a zip file with name say eg: test_ABC_UH_ccde2a_awdeaea_20150422.zip within that there are subdirectories on each directory we again have .zip files and in that we have files like mama20150422.gz and so on. Iam in need of a bash script so that it unzips... (0 Replies)
Discussion started by: Ravi Kishore
0 Replies

4. UNIX for Dummies Questions & Answers

UNIX - command to count number of files in subdirectories

I have a folder named test/ and under that I have multiple directories and in each of the directory I have multiple log files. I want to know how many files exists under each sub directory. test |--quanrantine |--logfile1 |--logfile2 |--spooling |--logfile1 ... (4 Replies)
Discussion started by: ravikirankethe
4 Replies

5. Shell Programming and Scripting

Bash script deleting my files, and editing files in subdirectories question

#!/bin/bash # name=$1 type=$2 number=1 for file in ./** do if then filenumber=00$number elif then filenumber=0$number fi tempname="$name""$filenumber"."$type" if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies

6. Shell Programming and Scripting

scp files from subdirectories only.

Hi there, Our current directory structure is set up as follows: -2013-09-20 - 380134664407418202 - 76523.html - 5331257754517660 - 76267.html - 76268.html - 76269.html - 76270.html - 76271.html - 76272.html - 76273.html - 76274.html -... (2 Replies)
Discussion started by: jimbojames
2 Replies

7. UNIX for Dummies Questions & Answers

list the files but exclude the files in subdirectories

If I execute the command "ls -l /export/home/abcde/dev/proj/code/* | awk -F' ' '{print $9}' | cut -d'/' -f6-8" it will list all the files in /export/home/abcde/dev/proj/code/ directory as well as the files in subdirectories also proj/code/test.sh proj/code/test1.c proj/code/unix... (8 Replies)
Discussion started by: shyjuezy
8 Replies

8. Shell Programming and Scripting

copy certain files from subdirectories

Hi all, I'd very grateful for some help with the following. I have a variable number of subdirectories each of which contain a uniquely names results file of the form Results*.dat. I would like to search through all subdirectories and copy out these results file to another directory so that... (3 Replies)
Discussion started by: iomaire
3 Replies

9. UNIX for Dummies Questions & Answers

Count number of files in subdirectories

Hello, I am new to unix and would like to have a count of all the files in the current directory as well as all the files in a subdirectory. The command I used was ls -R | wc -l but the number returned wasn't correct. Can someone please help? Thanks (2 Replies)
Discussion started by: cbeverly
2 Replies

10. UNIX for Dummies Questions & Answers

Searching files within subdirectories

I need to concatenate files that are inside a directory and subdirectories. Those files end with .c Can anyone help me I am using comand 9find) and (cat) but they don't work together.:confused: (1 Reply)
Discussion started by: jalvarez
1 Replies
Login or Register to Ask a Question