Page 2 of 2

Re: MoveFile problem

Posted: Sun Nov 18, 2018 6:19 pm
by Juan Carlos
Clyde wrote:
Sun Nov 18, 2018 2:13 pm
Ok, two things:

1. The callback function (p_MonitorizarMover) is just called, when you move a file from one partition to another. It is not called if you move the file within a partition (if I understood it correctly).

2. Let's say you want to move the file "hello.txt" to the folder "my_documents". You _cannot_ call MoveFile() like this:
MoveFile("hello.txt", "my_documents/")

Instead, you have to call it this way:
MoveFile("hello.txt", "my_documents/hello.txt")

This means you _have to_ specify the name of the file in the destination folder.
Humm, I have move the file but the new file called as the original file?, it is strange to move a file, ok, that process is first copy the file and after delete the source file, but MoveFile copy the file in the destinity directory without name and extension.

Re: MoveFile problem

Posted: Sun Nov 18, 2018 6:29 pm
by Juan Carlos
That function is the same the copyfile and it wirks fine.

Re: MoveFile problem

Posted: Sun Nov 18, 2018 9:32 pm
by Clyde
To be honest I struggle understanding you.

If you want to move a file you always have to specify the name of the file in the destination folder! This is different to CopyFile() where it is ok to just specify the destination folder without specifying the filename (if you want a different filename in the destination folder you have to use the third parameter of CopyFile()).

So, you can also imagine MoveFile() as a kind of file renaming. That means, if you want to move a file with in the same directory it is actually just a renaming:
MoveFile("hello.txt", "greetings.txt")

If you want to move a file in another folder you have to specify a filename in the destination folder:

possible/allowed: MoveFile("hello.txt", "documents/greetings.txt")
possible/allowed: MoveFile("hello.txt", "documents/hello.txt")

not possible/not allowed: MoveFile("hello.txt", "documents/")

Re: MoveFile problem

Posted: Mon Nov 19, 2018 2:46 pm
by Juan Carlos
Thank you Clyde, now I have idea of structure of this instruction, the problem was in that the string with the destination path and the name of file hadn't the / the routine is destinationstring/namefile the important is add the /.
Now I'm working with the move callback, because not move a file with other file with the same name, only give a error, I'll have get ask overwrite or cancel, I think that files with protection also have the problem.