Can any one tell me how can i change extension "*.X" to "*.Y" in a given directory
Below is the Picture of what i mean :-
Thankx in Advance
Posted on 2003-04-21 00:35:36 by telophase

Can any one tell me how can i change extension "*.X" to "*.Y" in a given directory
Below is the Picture of what i mean :-
Thankx in Advance


Just make a program that does a read write thing.

Or give up on windows and become a real programmer.

In other words..learn hex.
Posted on 2003-04-21 00:39:38 by IwasTitan
You would have to go through the folder with FindFirstFile/FindNextFile and pick out the files with the extension then rename them using SHFileOperation. At least that's how I would tackle the problem, there may be another way but I don't know it.
Posted on 2003-04-21 00:43:44 by donkey
Can u give me the required source code or a tutorial or atleast brief information??
Thankx
Posted on 2003-04-21 00:46:07 by telophase

Can u give me the required source code or a tutorial or atleast brief information??
Thankx


God NaN................................. I cannot believe you are asking such a question.

Numbers are static.

Integer relations?

If this "." is the zero point for logic then it is pretty simple isnt it.

What were those old ASCII codes and why were they chosen?
Posted on 2003-04-21 00:55:51 by IwasTitan
This algorithm isn't tested for what your doing but it should be pretty close, it's from a recursing thingy I wrote a while back. It requires a pointer to a path passed in SearchPath without the final "\" and a pointer to the extension in the format "*.EXT" I haven't worked the SHFileOperation into it, check your docs for that.
FileRename proc  SearchPath:DWORD,Extension:DWORD

LOCAL fhandle :DWORD
LOCAL FileData :WIN32_FIND_DATA
LOCAL FindFlag :BYTE
LOCAL FileName[MAX_PATH] :BYTE
LOCAL fFileBuffer{MAX_PATH] :BYTE

invoke StrLen,SearchPath
mov edi,SearchPath
add edi,eax
mov [edi],BYTE PTR "\"
mov [edi+1],BYTE PTR 0

invoke lstrcpy,ADDR FileName,SearchPath
invoke lstrcat,ADDR FileName,Extension

invoke FindFirstFile,ADDR FileName,ADDR FileData
mov fhandle,eax

.IF fhandle != -1
.repeat
mov eax,FileData.dwFileAttributes
and eax,FILE_ATTRIBUTE_DIRECTORY
.if eax == NULL
invoke lstrcpy,ADDR fFileBuffer,SearchPath
invoke lstrcat,ADDR fFileBuffer,ADDR FileData.cFileName
;################
; The variable fFileBuffer contains path and filename
;
; Do your SHFileOperation here
;################
.endif
invoke FindNextFile,fhandle,ADDR FileData
mov FindFlag,al
.until FindFlag == 0
invoke FindClose,fhandle
.ENDIF
ret
FileRename Endp
Posted on 2003-04-21 01:10:53 by donkey



God NaN................................. I cannot believe you are asking such a question.


... its not nan
Posted on 2003-04-21 02:19:40 by abc123
NaN!=Gollum :)
Posted on 2003-04-21 02:36:20 by Vortex
lol :grin:
Posted on 2003-04-21 03:18:18 by Delight

Am I the only one that thinks that telophase should change his avatar? Maybe not a stolen one the next time. :grin:
Posted on 2003-04-21 03:42:44 by Maverick
Seemed like some people look at the avatar and not the name :grin:
Posted on 2003-04-21 03:49:42 by roticv
I think on his first post with the avatar I asked him if he was related to NaN, there is a startling family resemblance, they're almost twins :grin:

BTW NaN has changed back to Shrek
I guess there's no danger of anyone stealing mine though so I don't mind.
Posted on 2003-04-21 03:55:36 by donkey
Maybe,there is a genetic transfer that we don't know. :)
Posted on 2003-04-22 03:00:02 by Vortex