Move a file from one location to another

Hello

I'm trying to move a file from one location to another in Linux.. I can rename files, but not move them.

This is my code:
1
2
rename("/home/myNAME/Bureaublad/folder1/folder2/test.txt", "/home/myName/desktop/test.txt");


Why ain't this working?

Thanks for reading,
Niely
but not move them.
What is happening? What does function returns? What is errno is set to?
Okay, the file part works now.
But the folder (what I actually needs not).

This is what I get if I return the int value of the function + the error value:
-1
Error: Directory not empty


How can I move it with a filled directory?
You can rename a nonempty directory. However, destination should be empty (or not exist).
ENOTEMPTY or EEXIST
newpath is a nonempty directory, that is, contains entries
other than "." and "..".
http://man7.org/linux/man-pages/man2/rename.2.html
^Thanks! Just added a random folder after desktop and it works without problems now!
THANKS A LOT!
Topic archived. No new replies allowed.