目前,NFS文件系统上的单个目录中有450万个文件。因此,对该目录的任何读取或写入操作都会导致很大的延迟。 为了解决这个问题,该目录中的所有文件将根据其创建年份移动到不同的目录中。
显然,由于文件量很大,我们使用-ctime选项的find命令无法正常工作。 我们尝试根据创建年份列出文件,然后将列表提供给脚本,该脚本将在for循环中移动它们。但是,即使这个失败了,因为ls -lrt还没有成功。
还有其他方法可以解决这个问题吗? 请帮忙。
脚本内容: 1)filelist.sh
ls -tlr|awk '{print $8,$9,$6,$7}'|grep ^2011|awk '{print $2,$1,$3,$4}' 1>>inboundstore_$1.txt 2>>Error_$1.log
ls -tlr|awk '{print $8,$9,$6,$7}'|grep ^2011|wc -l 1>>count_$1.log
2)filemove.sh
INPUT_FILE=$1 ##text file which has the list of files from the previous script
FINAL_LOCATION=$2 ##destination directory
if [ -r $INPUT_FILE ]
then
for file in `cat $INPUT_FILE`
do
echo "TIME OF FILE COPY OF [$file] IS : `date`" >> xyz/IBSCopyTime.log
mv $file $FINAL_LOCATION
done
else
echo "$INPUT_FILE does not exist"
fi