Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gzip files 3 at a time

Status
Not open for further replies.

Parttimer

Technical User
Aug 14, 2003
2
US
How do I --
Using a ksh script - Process a list of files and gzip or compress them. Say 15 files. And process 3 at a time (to limit CPU usage). Then process the next 3 until all done.



 
Try something like this:
Code:
typeset -i i=0
while read file; do
  gzip "$file" &
  i=$((i+1))
  [ $i -eq 3 ] && i=0 && wait
done <path/to/ListOfFiles
wait


Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top