So, I've got a ton of files that I want to go through (ie something like 300,000), and they're all labeled sequentially. However I'm not 100% positive that they are all there.
Is there any way of running through a sequence of numbers, checking if the file is in the folder, if not appending it to a file so I can figure out if any are missing?
Lets see if i have understood you correctly:
The files you have are called:
file1x
file2x
file3x
...
but maybe there are missing numbers which you want to find. Correct?
If so, the following example should do the trick:
#! /bin/ksh
typeset -i iMinNum=1
typeset -i iMaxNum=9
typeset -i iWork=0
typeset fLog=./mylogfile
(( iWork = iMinNum ))
while [ $iWork -le $iMaxNum ] ; do
if [ ! -f ./file${iWork}x ] ; then
print - "File file${iWork}x is missing" >> $fLog
fi
(( iWork += 1 ))
done
I hope this helps.
bakunin
Try this ....:
Assume that the file names are file1 file2 file3....file10
seq -f "file%g" 1 10 | xargs ls -l | grep -v '^-'