Archive: Search files with globbing.


Search files with globbing.
Hellow !

I have a new problem and I don't know how to fix it.

So, I have a directory: for example "C:\toto"
In this directory I have a lot of files.

I want to know if in this directory there is a file that starts with "hey"

So I need to use a command like this: "search a file like 'hey*' in the dir 'C:\toto' "

My English is not very cool so tell me if you don't understand ^^

I think I have to use FindFirst and FindNext functions but... :(


${If} ${FileExits} "c:\toto\hey*"


Haaaaan !

I don't know how to say it in English but I think it's "I am a dumb"...

Thanks a lot.


And if I want to rename the file I founded in the directory, how can I do this ?

Because this won't work : Rename "c:\toto\hey*" "c:\toto\tragada"


You can't use wild cards. Rename can only work on single files.

Stu


You can use the Locate function for that:
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.2


Yep, I have already looked at Locate but I don't understand how this will be helpful because I just want to rename a file, only problem is that I only know the beginning of the filename.


You could also just use:

FindFirst $R0 $R1 $DIR\*file.txt
FindClose $R0

Rename $DIR\$R1 ...

Stu


It's working veeeeery well ! Thanks all !! =) =) =)