Click here to Skip to main content
14,211,624 members
Rate this:
Please Sign up or sign in to vote.
See more:
How to use rename(const char *oldpath, const char *newpath) for move the file or directory ?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If you have had googled you might not need this question. Any way

The rename() function shall change the name of a file. The old argument points to the pathname of the file to be renamed. The new argument points to the new pathname of the file.
#include <stdio.h>

int status;
status = rename("/home/cnd/mod1", "/home/cnd/mod2");

Read this for aditional details.
rename(3): rename file - Linux man page[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.2 | Last Updated 13 Jan 2016
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100