I am moving a file from /tmp/ folder to another path. I am using "rename" function to move file to another path. But rename returns -1 and errno = 18 (Invalid cross-device link). Error no 18 means: "The directory containing the name newname must be on the same file system as the file (as indicated by the name oldname)"

Can someone suggest a way to move this file.


If rename() is failing, you need to do the move manually, i.e. implement a copy-and-delete scheme.

  • 1
    I am creating a sqlite database in temp folder. Now I want to copy that file to another folder. Is there any sqlite command to rename the sqlite database file? I was trying with rename function. but it fails with error 18 – Sandy Sep 3 '12 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.