Wildcards???

Just starting out? Need help? Post your questions and find answers here.
Mr Tickle
User
User
Posts: 25
Joined: Mon Oct 13, 2003 10:33 pm
Location: England, Derbyshire.

Wildcards???

Post by Mr Tickle »

Hi,

I would like to move all the *.txt files from 1 dir to another. I'm using the RenameFile() command which works fine for single named files( RenameFile("C:\Temp\FileA.txt", "C:\Temp\FileB.txt") ).

Is there a way to use wildcards? (*.*, *.zip, *.txt etc) If not can anyone suggest a workaround? I have a comboboxgadget to select the appropriate wildcard.

Thanks in advance.
Mr Tickle.
Athlon xp 2500+, Gigabyte KT400-FSB333, Gf3 Ti200, SB Live 5.1
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Why not use 'examinedirectory()' to get the files from source folder?
Mr Tickle
User
User
Posts: 25
Joined: Mon Oct 13, 2003 10:33 pm
Location: England, Derbyshire.

Post by Mr Tickle »

Thanks Pupil, Works a treat ;)

Code: Select all

    If ExamineDirectory(0, File$, Filter$)   ; going to examine the dir For selected files
      n = NextDirectoryEntry()      ; this returns TRUE if there is a NEXT *.dta file
      While n
         filename$ = DirectoryEntryName() ; get the CURRENTLY found filename only - not path
         n = NextDirectoryEntry()  ; try to find another file with same type (Filter$)
         RenameFile(Source$ + filename$, Dest$ + filename$)
      Wend
   EndIf
I thought I'd post the snippet incase it's useful to anyone else.
Mr Tickle.
Athlon xp 2500+, Gigabyte KT400-FSB333, Gf3 Ti200, SB Live 5.1
Post Reply