|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
process file in diffrent directory
let say i have 1 directory that have 3 folders in it such
1.log--b2b/dsc 2.processed--b2b/processed 3.dsc--b2b/logs last time, i used to write the same script for 3 different folder for FILE in *_7B1* do curr_year=$(date +%Y) curr_month=$(date +%Y%m) file_year=$(echo $FILE| cut -d'_' -f4|cut -c 1-4) file_month=$(echo $FILE|cut -d'_' -f4|cut -c 1-6) if [[ $curr_year = "$file_year" ]] then if [ `expr $curr_month - 3` -ge $file_month ] then echo $FILE mv $FILE /u006/r45647/Izza/b2b/dsc/archivedsc echo "file transfer complete" fi fi ------------------------------------- my question is how i'm gonna use just 1 script to all the directories? means that , 1) the script will go from 1 directory to another directory. 2)in the script itself..it will move the files into another directory that i already created eq: in folder b2b/dsc-->the file will be move to b2b/dsc/archivedsc it looks like simple.. but i donno how to solve it! please |
|
#2
|
|||
|
|||
|
I made up folder names - try this
Code:
for folder in /path1/folder1 /path1/folder2 /path1/folder3
do
cd $folder
for FILE in *_7B1*
do
curr_year=$(date +%Y)
curr_month=$(date +%Y%m)
file_year=$(echo $FILE| cut -d'_' -f4|cut -c 1-4)
file_month=$(echo $FILE|cut -d'_' -f4|cut -c 1-6)
............... insert rest of code here.
done
cd -
done
Use code tags next time, you'lll get more complete answers. |
|
#3
|
|||
|
|||
|
no answers, just a Q
assumed you are not working on december 31 23.59.59 (maybe you should check it) and the progs take < 1 second why do you recalculte the year && month in a loop ?
__________________
working on Solaris[5-9], preferred languages french and C. |
|
#4
|
|||
|
|||
|
ok...
Quote:
because the program will move the 3 months ago files.. so i just thinking calculating the day only..that was 92 days rite? |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > process file in diffrent directory |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|