Sunday, July 20, 2014

Counting the files in all sub drectories of a folder

Assumptions:
Given a directory; it has n subdirectories and does not have any files. The subdirectories jsut have files and no folders.
You want to count all the files in the n sub directories.

here's a shell script:
filecount=0;
for i in $(ls);
do
cd $i;
a=$(ls | wc -l) ;
filecount=$[filecount+a];
echo $filecount;
cd ..;
done

adding numbers is a bash script

num=$[num1+num2]
there are many more options, but this is the simplest.
Note no spaces between any of the characters above

Tuesday, April 8, 2014

initializing cell arrays

a=cell(dim)

Monday, March 24, 2014

changing group permissions

chgroup -R <groupname> <file/foldername>

Sunday, March 16, 2014

Some useful commands.. to be edited later..

root@master:/home/cloudcv/detection_executable/PascalImagenetDetector/distrib# cat job.x

output_dir=$1
model_name=$2

./run_PascalImagenetBboxPredictor.sh /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/ "/home/cloudcv/detection_executable/input_images/im_folder_xx/" "/home/cloudcv/detection_executable/model/" "$output_dir" "0" "$model_name"


for i in {1..50}; do sed 's/xx/'$i'/g' job.x  > job.$i; done

Saturday, March 15, 2014

some printing formats..

for i in {0..10};do printf "%02d\n" $i; done

for i in {000..100};do echo $i; done

Wednesday, March 12, 2014

putty windows ssh using GUI option

http://www.ece.unm.edu/csg/email/XServer_Putty_Windows7-ECE.pdf