Find command when there exist many files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find command when there exist many files
# 8  
Old 02-18-2018
Progress Bar

I have found a progress bar on github but when I try the following it does not
do anything

Code:
source progress_bar.sh
progress_bar 300

GitHub - nachoparker/progress_bar.sh: Progress bar for the shell

---------- Post updated at 10:36 AM ---------- Previous update was at 08:55 AM ----------

I have now modified my script this way. It works properly, however I have a white
on black colour scheme on my terminal and I am noticing a white box scrolling along
the line all the time. Can this be fixed?

Code:
# Counts the number of files to process
totfcn=$(find . -type f | tee /tmp/wrk | wc -l)

i=0; j=0
while read fn; do    
  printf -v XXX "%0*d" $((60 * ++i / totfcn))
  printf "\r[%-60s]" "${XXX//0/*}"
  printf "%4d%%" $((100 * ++j / totfcn))
  #${dir_mseed2sac}/mseed2sac $FN
done < /tmp/wrk
printf "\n"

# 9  
Old 02-18-2018
Quote:
Originally Posted by kristinu
I have now modified my script this way. It works properly, however I have a white
on black colour scheme on my terminal and I am noticing a white box scrolling along
the line all the time. Can this be fixed?

Code:
# Counts the number of files to process
totfcn=$(find . -type f | tee /tmp/wrk | wc -l)

i=0; j=0
while read fn; do    
  printf -v XXX "%0*d" $((60 * ++i / totfcn))
  printf "\r[%-60s]" "${XXX//0/*}"
  printf "%4d%%" $((100 * ++j / totfcn))
  #${dir_mseed2sac}/mseed2sac $FN
done < /tmp/wrk
printf "\n"

The white box is probably you input cursor you can hide/view it like this:

Code:
# Counts the number of files to process
totfcn=$(find . -type f | tee /tmp/wrk | wc -l)

# Hide cursor
tput civis

# Reveal cursor on program completion
trap 'tput cvvis' EXIT

i=0; j=0
while read fn; do    
  printf -v XXX "%0*d" $((60 * ++i / totfcn))
  printf "\r[%-60s]" "${XXX//0/*}"
  printf "%4d%%" $((100 * ++j / totfcn))
  #${dir_mseed2sac}/mseed2sac $FN
done < /tmp/wrk
printf "\n"

This User Gave Thanks to Chubler_XL For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find command to find a word from list of files

I need to find a word '% Retail by State' in the folder /usr/sas/reports/RetailSalesTaxallocation. When I tried like below, -bash-4.1$ cd /usr/sas/reports/RetailSalesTaxallocation -bash-4.1$ find ./ -name % Retail by State find: paths must precede expression: Retail Usage: find ... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies

2. Shell Programming and Scripting

Find if a directory exist from a list of the path

Hello, i want to script on sh to check from a path if the directory exist and isn't empty. I explain: path is : /aaa/bbb/ccc/ccc_name/ddd/ Where the cccc_name is in a list, so i think it's $1 My command find -name /aaa/bbb/ccc/$1/ddd/ didn't work because my $1 is the same and not... (5 Replies)
Discussion started by: steiner
5 Replies

3. UNIX for Dummies Questions & Answers

Command to find files

Hi All, Can anyone give me the command to copy files from 03-Mar-2013 to 07-Mar-2013 in folder. there are nearly 40+ thousand files in directory , so I just need files from Mar 3rd to Mar 7th and copy them to a location . Need quick help pls (2 Replies)
Discussion started by: rockingvj
2 Replies

4. Shell Programming and Scripting

find + move if destination path does not exist

hi frnds, please help ... what will happen with below command if destination path does not exist on the system.... find /var/adm/cft* -mtime +1 -exec mv {} /global/ \ in unix its remove all my files from the system from soruce file ... how is it possbile (1 Reply)
Discussion started by: dodasajan
1 Replies

5. Shell Programming and Scripting

what is the find to command to find the files created last 30 days

what is the find to command to find the files created last 30 days (5 Replies)
Discussion started by: rajkumar_g
5 Replies

6. Shell Programming and Scripting

Find out whether files exist.

I have the following data stored in a file. 1 /home/file13 /home/file2 2 /home/file41 /home/file654 3 /home/file61 /home/file45 4 /home/file81 /home/file43 ... I want to print the first column provided the files represented by the second and third column exist. How to do that? (3 Replies)
Discussion started by: kevintse
3 Replies

7. UNIX for Dummies Questions & Answers

How to find if file exist in directory using *

Hi, I know how to use the test command ( ...) to find a single given name file. However, I have a case in which I have a directory with one file and one sub-directory. I know that the file starts with "fub". The command doesn't work if i call the file "fub*" as it doesn't understand I meant a... (2 Replies)
Discussion started by: buj
2 Replies

8. Shell Programming and Scripting

Little bit weired : Find files in UNIX w/o using find or where command

Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same. Thanks in advance. Regards Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies

9. UNIX for Dummies Questions & Answers

Find in file. Does this exist under UNIX?

Hello, I have the following problem. I know there is a file somewhere on a UNIX machine that contains a string, but I don't know where. With the "grep" command, I can look into a file but only if I'm located in the correct directory. With the "find" command, I can search across directories... (2 Replies)
Discussion started by: scampsd
2 Replies

10. Shell Programming and Scripting

Can I find wether a particular file exist and size greater than zero...help please

Can I find wether a particular file exist and size greater than zero in one line command. similar to this if && something in one if test .... e.g. if 1.) is it possible ? ... if yes how 2.) what would be the return type in case there is success or failure. I mean if both are... (4 Replies)
Discussion started by: guhas
4 Replies
Login or Register to Ask a Question