Noude
17th August 2010 10:13 UTC
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... :(
MSG
17th August 2010 10:38 UTC
${If} ${FileExits} "c:\toto\hey*"
Noude
17th August 2010 10:54 UTC
Haaaaan !
I don't know how to say it in English but I think it's "I am a dumb"...
Thanks a lot.
Noude
17th August 2010 11:05 UTC
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"
Afrow UK
17th August 2010 11:28 UTC
You can't use wild cards. Rename can only work on single files.
Stu
jpderuiter
17th August 2010 11:37 UTC
You can use the Locate function for that:
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.2
Noude
17th August 2010 13:15 UTC
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.
Afrow UK
17th August 2010 13:23 UTC
You could also just use:
FindFirst $R0 $R1 $DIR\*file.txt
FindClose $R0
Rename $DIR\$R1 ...
Stu
Noude
17th August 2010 13:49 UTC
It's working veeeeery well ! Thanks all !! =) =) =)