Exp3
Exp3
Experiment No.3
Implement basic command of linux “mv” using kernel APIs.
Date of Performance:
Date of Submission:
Vidyavardhini’s College of Engineering & Technology
Department of Computer Engineering
Program:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
if (argc != 3) {
fprintf(stderr, "Usage: %s <source> <destination>\n", argv[0]);
return EXIT_FAILURE;
}
Outcome:
Conclusion:
The mv command in Linux can be efficiently implemented using the rename() system
call. This method ensures atomicity and avoids unnecessary data copying. However,
rename() does not work across different file systems; in such cases, manual copying
Vidyavardhini’s College of Engineering & Technology
Department of Computer Engineering