rename command will change the name of hello.txt->hi.txt. We have to be sure that both paths(c:\ie\ ) be the same.Since rename cant move files within Directories (MSDN).
-Now we check the dstPattern <20>does it contain a Path?:
-If does: we divide it in dstPath and dstFile.AND ALSO CHECK THAT dstPath and srcPath it<69>s the same(see syntax error).If they aren the same we launch an error.
-If doesnt then we copy srcPath to dstPath(see #way2) and also saving dstPattern as dstFile.
"p" will store a REAL name file(It uses f.cFileName)
Real name file is the name that FindFile returns us.FindFile return NULL if it doesnt find the Source File that we want to rename.And returns the name if finds it.
Do while is used to manage Wildcards.So we can iterate Finding all the files with the Wildcards in it.
But wildcards (? and *) has different behavior so we have to be carefull.
"q" stores the srcFile(this can be a real name file but ALSO A NAME FULL OF WILDCARDS)(p always has a REAL NAME)(This is the most difficult point to understand the code)
At last we just make a MoveFile(srcFinal, dstFinal)):
Also there are a Bunch of Flags (the options)
.It makes the code more difficult to understand.But they are just option flags that show or hides errors,that prevents system files to be renamed...and so.