Linked Questions

-2 votes
1 answer
1k views

My code has a directory path incoming, e.g., $D_path from a source. Now I need to check if the directory path exists and the count of files with a pattern (*abcd*) in that path exists or not in an IF ...
A_R's user avatar
  • 29
0 votes
1 answer
1k views

I am using BASH to attempt to automate a very tedious manual scanning process. I am very new to scripting and am learning as I go, but I've been googling and reading manuals for a day and a half and ...
Geordeaux's user avatar
-1 votes
2 answers
457 views

I have to count all executable files- done it and count files which are .sh files- no idea how to do it. Any help? Here's my code: c=0 d=0 for f in /home/lenovo/*; do if [ -x "$f&...
ktoś tam's user avatar
2 votes
0 answers
119 views

I have a script that generates a .log file when the job finishes. I do not want it to move on until the number of .log files equals the number of .com files. Currently, if I execute this script it ...
Pyrodancer123's user avatar
-1 votes
1 answer
85 views

i am a new user and I was trying to build a script with which i can count how many files are in a direcotry, i did this but it does not seem to work. #! /bin/bash read -p 'path: ' dir dir=$dir if [ &...
Bioscotch's user avatar
543 votes
1 answer
961k views

To count the number of files in a directory, I typically use ls directory | wc -l But is there another command that doesn't use wc ?
Kantura's user avatar
  • 6,723
19 votes
7 answers
13k views

ls displays the files available in a directory. I want the file names to be displayed based on the length of the file name. Any help will be highly appreciated. Thanks in Advance
Zama Ques's user avatar
  • 1,554
6 votes
3 answers
13k views

For a security test, I need to pass a file that contains null characters in its content and its filename. For the body content, it's easy to use printf: $ printf "Hello\00, Null!" > containsnull....
Milk's user avatar
  • 2,667
6 votes
3 answers
2k views

Is there a reason why find . -mindepth 1 -maxdepth 1 | wc -l is suggested against ls -1 | wc -l (or vice-versa ?) to count the total number of files/directories inside a folder Notes: This ...
sjsam's user avatar
  • 22k
3 votes
2 answers
3k views

Normally the output of wc -l command gives the number of lines in a file. But, when we pipe the output of ls command to it, it seems to show the number of files and directories and links in the ...
Tej's user avatar
  • 33
-2 votes
1 answer
2k views

I need to count all the files present in a directory and all its subdirectory with specific file extensions using shell script. Ex: I want a count of all the .py and .sh files in a directory and its ...
pavan kumar's user avatar
3 votes
5 answers
296 views

We just installed a mass filer device that we want to store data from our suppliers on. They FTP files to it every day and right now, we've about 60,000+ files. Doing find . -name '*TXT' -exec ls '{}'...
Chris's user avatar
  • 1,693
2 votes
1 answer
153 views

I am writing a shell and currently implementing the pipe process. I am able to run "ls -l | wc", but when running "ls -l|wc" the process fails. I have tried debugging with gdb but unable to make ...
Continuum's user avatar