help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Loop over,


From: Val Krem
Subject: [Help-bash] Loop over,
Date: Tue, 6 Sep 2016 02:59:23 +0000 (UTC)

Hi all,

I have one script that works fine for a particular job. My problem is now I 
have to repeat running this script several time to do the same job for 
different sets of data that are located in different directories (folders). My 
files are in two separate folders.

I have two issues here.
1) How can I tell the script if the file is not  in one folder then  look for 
another folder?
2) How could I run 52, in this case, times in one  touch?


Here is my  beginner script

#########################################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@####

# ! /bin/bash

NAMES="Week1 week2... week52 "
for S in $NAMES
do
    export S
    echo "   Start       "
    dat=$S # get the name of the weeks
    # DEFINE  FOLDERS
    rdat1=/data/year/month/${dat}           # the first folder
    rdat2=/data/year/month/week/${dat}      # second folder
    tmp=/data/result/${dat}

    [ -d ${tmp}  ] && echo "Directory Exists" || mkdir ${tmp}    # my working 
directory


    file=${rdat1}/*.zip  OR  file=${rdat2}/*.zip        ### here is my 
problem!!!!
    cp ${file}  ${tmp}
    unzip  ${tmp}/'*.z'
    etc1                                           @@@ this other steps that 
does some editing of data
    etc3
    etc4




    etc65                                        @@@@@  last step of doing in 
the script

    done               
   echo " End of escript"
##########################################################################################################


Thank you in advance


reply via email to

[Prev in Thread] Current Thread [Next in Thread]