Is there any way by which I can change to any directory by executing a C program?
The cd command, also known as chdir (change directory), is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.
Use the cd command to move from your present directory to another directory. You must have execute (search) permission in the specified directory.
Often, you may want to change the current working directory, so that you can access different subdirectories and files. To change directories, use the command cd followed by the name of the directory (e.g. cd downloads ). Then, you can print your current working directory again to check the new path.
In Windows operating systems, the C drive as represented as “C:\”, the backlash representing the root directory of the drive. The C drive is considered as the primary hard drive of the system and is used for storing the operating system, system files and other applications and their related files.
The chdir()
function. For more info, use man chdir
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With