comparison moefetch.sh @ 201:30d2fb656029

scrapping grep -vf
author edhoprima@gmail.com <edhoprima@gmail.com>
date Mon, 29 Jun 2009 15:40:28 +0000
parents 8efa600ebfdb
children 3dbb5a6678f9
comparison
equal deleted inserted replaced
200:8efa600ebfdb 201:30d2fb656029
156 echo "You don't own the ${BASE_DIR}/${FOLDER}, applying globally writeable permission on it" 156 echo "You don't own the ${BASE_DIR}/${FOLDER}, applying globally writeable permission on it"
157 chmod -R u=rwX,g=rwX,o=rwX "${BASE_DIR}/${FOLDER}" || Err_Fatal "Error changing ownership. This shouldn't happen" 157 chmod -R u=rwX,g=rwX,o=rwX "${BASE_DIR}/${FOLDER}" || Err_Fatal "Error changing ownership. This shouldn't happen"
158 fi 158 fi
159 done 159 done
160 [ "$(Count_Files "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}")" -eq 0 ] && ISNEW=1 160 [ "$(Count_Files "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}")" -eq 0 ] && ISNEW=1
161 for i in error ok list newlist; do 161 for i in error ok list newlist templist; do
162 touch "${TEMP_PREFIX}-${i}" || Fatal_Err "Error creating ${TEMP_PREFIX}-${i}. This shouldn't happen" 162 touch "${TEMP_PREFIX}-${i}" || Fatal_Err "Error creating ${TEMP_PREFIX}-${i}. This shouldn't happen"
163 done 163 done
164 # 164 #
165 } 165 }
166 166
230 echo "Generating list of new files..." 230 echo "Generating list of new files..."
231 # THE FILES 231 # THE FILES
232 #ls "../${TARGET_DIR}" | grep -vf "${TARGET_DIR}-error" > "${TARGET_DIR}-ok" 232 #ls "../${TARGET_DIR}" | grep -vf "${TARGET_DIR}-error" > "${TARGET_DIR}-ok"
233 # 233 #
234 find "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}" | comm -1 -3 "${TEMP_PREFIX}-error" - | sed -e "${SED_GET_FILENAME}" > "${TEMP_PREFIX}-ok" 234 find "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}" | comm -1 -3 "${TEMP_PREFIX}-error" - | sed -e "${SED_GET_FILENAME}" > "${TEMP_PREFIX}-ok"
235 cat "${TEMP_PREFIX}-list" | grep -vf "${TEMP_PREFIX}-ok" > "${TEMP_PREFIX}-newlist" 235 cat "${TEMP_PREFIX}-list" > "${TEMP_PREFIX}-templist"
236 while read -r IS_OK; do
237 cat "${TEMP_PREFIX}-templist" | grep -v "${IS_OK}" > "${TEMP_PREFIX}-newlist"
238 cat "${TEMP_PREFIX}-newlist" > "${TEMP_PREFIX}-templist"
239 done < "${TEMP_PREFIX}-ok"
240 #cat "${TEMP_PREFIX}-list" | grep -vf "${TEMP_PREFIX}-ok" > "${TEMP_PREFIX}-newlist"
236 echo "$(echo $(wc -l < "${TEMP_PREFIX}-newlist")) file(s) to be downloaded" 241 echo "$(echo $(wc -l < "${TEMP_PREFIX}-newlist")) file(s) to be downloaded"
237 242
238 else 243 else
239 if [ "${ISQUICK}" ]; then 244 if [ "${ISQUICK}" ]; then
240 echo "quick mode selected. Skipping check" 245 echo "quick mode selected. Skipping check"