1

Topic: c ++ builder to Find in a folder missing files

There is a folder c:\test
In it files:
0003.pdf
0025.tif
0004.pdf
0002.pdf
0006.pdf
0010.tif
It is necessary in the field memo to deduce passed numbers (what files miss)
In this case there are such numbers:
0001
0005
0007-0009
0011-0024

2

Re: c ++ builder to Find in a folder missing files

Write the generator of names which should be and compare to that that is.

3

Re: c ++ builder to Find in a folder missing files

In above resulted list min=0002, max=0025
In this case there are such numbers:
0005
0007-0009
0011-0024

4

Re: c ++ builder to Find in a folder missing files

sfsf wrote:

In this case there are such numbers:

And still there are numbers 0026-9999, ABCD, XYZ etc., etc. In what a problem? You do not know
How the file list to receive or it is impossible to process the received list?

5

Re: c ++ builder to Find in a folder missing files

for i = 1 to 99999
file_pattern = right ("0000" AND i, 4) AND ". *"
if Dir (file_pattern) = vbNullString then
print "not found for" AND i
end if
next

On With itself you will translate

6

Re: c ++ builder to Find in a folder missing files

0000-9999 only such numbers.
I read so
int iAttributes = faAnyFile;
int done = FindFirst (dirr, iAttributes, sr);
while (! done)
{
done = FindNext (sr);
ttt=sr. Name;
}
FindNext (sr) reads files from the directory sorted not on a name.
I need to receive the list on increase of the passed files. If it is passed successively n-files to specify a pass range,  0011-0024
Help to implement.

7

Re: c ++ builder to Find in a folder missing files

It read?

8

Re: c ++ builder to Find in a folder missing files

Somehow so:

int iAttributes = faAnyFile;
int done = FindFirst (dirr, iAttributes, sr);
int c = 0;
while (! done)
{
done = FindNext (sr);
ttt=sr. Name;
int aaa = StrToInt (ttt);
if (c <aaa)
{
printf ("%04d- % 04d\n", c, aaa-1);
c = aaa+1;
}
}

To rectify errors and to add pair of missing lines, I hope, you, I hope, you can.

9

Re: c ++ builder to Find in a folder missing files

Friends how it is possible to deduce names of files sorted by names.
Now in such type
2014.pdf
0776.pdf
2401.pdf
1254.pdf
1238.pdf
3430.pdf
2039.pdf
2776.pdf
2949.pdf
1829.pdf
3217.pdf
3435.pdf
0359.pdf
1515.pdf

10

Re: c ++ builder to Find in a folder missing files

RTFM TStringList. Sort ()

11

Re: c ++ builder to Find in a folder missing files

sfsf wrote:

Friends how it is possible to deduce names of files sorted by names.

Most likely it FAT. Replace on NTFS and it produces the sorted list. Or simply save names in an array and sort qsort ()