![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding which file is missing | SAMZ | UNIX for Advanced & Expert Users | 10 | 06-25-2008 08:30 AM |
| Finding files with names that have a real number greater then difined. | harmonwood | Shell Programming and Scripting | 2 | 11-09-2007 10:28 AM |
| Reading special characters while converting sequential file to line sequential | Rajeshsu | High Level Programming | 2 | 07-10-2006 02:38 PM |
| how to find capital letter names in a file without finding words at start of sentence | kev269 | Shell Programming and Scripting | 1 | 04-10-2006 09:35 PM |
| inserting uniq sequential numbers at the start of the file | jingi1234 | UNIX for Dummies Questions & Answers | 7 | 11-19-2005 06:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Finding missing sequential file names
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: Code:
#! /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
bakunin |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|