how to determine the folder contain data or not
hi all,
let me clarify it :
my script actually will move the old record in each directory
example:
for folder in $DSC $LOGS $PROCESSED $BAD $PROCESSED_7B1
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)
specific_month=$(echo $FILE|cut -d'_' -f4|cut -c 5-6)
-
.....bla..bla..
if [[ `expr $curr_year - 2 ` -ge $file_year ]]
then
echo $FILE
mv $FILE ARCHIVE
echo "file transfer complete"
fi
...bla..bla..blaa
<old file will be move to the ARCHIVE folder>
but when there is no data on that folder, there is error like this :
expr: 0402-050 Syntax error.
ARCHIVE_B2B_SCRIPT.sh[69]: test: 0403-004 Specify a parameter with this command.
*_7B1*
mv: 0653-401 Cannot rename *_7B1* to ARCHIVE/*_7B1*:
A file or directory in the path name does not exist.
can u help me to solve this?
|