May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.
#!/bin/tcsh ... echo "Enter Directory Name:" set mydir = $< echo "Calculating the total of the size of all files in the directory tree" echo "" set mysum = 0 #variable to hold sum set filelist = $mydir set mycursize = 0 #variable to hold current filesize echo $filelist foreach x ($filelist) @ mycursize = `stat -c%s $x` #finds current filesize echo "size of $x is $mycursize" @ mysum = $mysum + $mycursize #accumulator end echo "The sum of the size of all files in this directory is: $mysum" ...
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.