Re: Could this be faster? Atten: C Bouzy
- Posted by Bernie Ryan <xotron at bluefrog.com> Dec 15, 2005
- 568 views
C Bouzy wrote: > > Bernie Ryan wrote: > > > > > > If you do this: > > }}} <eucode> > > system(dir \\*.aac > MDIR.txt,2) > > system(dir \\*.mp4 >> MDIR.txt,2) > > system(dir \\*.mp3 >> MDIR.txt,2) > > system(dir \\*.mp2 >> MDIR.txt,2) > > system(dir \\*.mp1 >> MDIR.txt,2) > > system(dir \\*.ogg >> MDIR.txt,2) > > system(dir \\*.wav >> MDIR.txt,2) > > </eucode> {{{ > > > Bernie, > > Thanks for the suggestion, but that will not work for what I am doing. > That would only work for the parent directory. If there is more than > one directory in the parent directory, it will not scan the child directories. > > Try the following program on your system and compare it to walk directory. I am curious if it would be faster.
--------------------------BEGIN CODE DIRTEST.EX ----------------------------- -- include wildcard.e -- atom ptr, ptr2 integer fd, fo sequence out, s, fout object line -- puts(1,"searching aac") system("dir /S >NUL C:\\*.aac > dirlist.txt",0) puts(1,"searching mp4") system("dir /S >NUL C:\\*.mp4 >> dirlist.txt",0) puts(1,"searching mp3") system("dir /S >NUL C:\\*.mp3 >> dirlist.txt",0) puts(1,"searching mp2") system("dir /S >NUL C:\\*.mp2 >> dirlist.txt",0) puts(1,"searching mp1") system("dir /S >NUL C:\\*.mp1 >> dirlist.txt",0) puts(1,"searching ogg") system("dir /S >NUL C:\\*.ogg >> dirlist.txt",0) puts(1,"searching wav") system("dir /S >NUL C:\\*.wav >> dirlist.txt",0) -- fd = open("dirlist.txt","r") fo = open("dirlist.out","w") fout = "constant\nlist_of_files = {\n" line = gets(fd) while sequence(line) do while equal(line[1],' ') or equal(line[1],'\n') do line = gets(fd) if atom(line) then close(fd) close(fo) abort(0) end if end while if match("Directory of ",line) then s = line[14..$-1] out = {} for i = 1 to length(s) do if s[i] = 92 then out &= {92,92} else out &= s[i] end if end for fout &= "\n{"&out&"},"&"\n\n" line = gets(fd) end if ptr = find(':',line) if ptr then if match("Total ",line) then exit end if out = line[ptr+5..$-1] -- file name ptr = match(upper(out[$-2..$]),line)+3 while 1 do -- find start of size. if line[ptr] = ' ' then ptr += 1 else exit end if end while ptr2 = ptr while 1 do -- find end of size. if line[ptr2] != ' ' then ptr2 += 1 else exit end if end while s = line[ptr..ptr2] while 1 do -- remove commas. ptr = find(',',s) if ptr then s = s[1..ptr-1]&s[ptr+1] else exit end if end while fout &= "{"&out&","&s&"},"&"\n" line = gets(fd) end if end while fout = fout[1..$-2]&"}" puts(fo,fout) close(fd) close(fo) --------------------------------- END CODE ----------------------------------
----If you continue to do what you have always done, you will get what you have always gotten.---- Bernie My files in archive: w32engin.ew mixedlib.e eu_engin.e win32eru.exw Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan