Questions tagged [chdir]

chdir (or cd) is a command to change the working directory (change directory). It is part of many operating systems and programming languages. On many OS `chdir()` also is a system call.

cd, sometimes also available as chdir (change directory), is a command line command to change the current working directory in operating systems such as Unix, DOS, OS/2, AmigaOS (where if a bare path is given, cd is implied), Windows, and Linux. It is also available for use in shell scripts and batch files.

More details see cd Wikipedia article

202 questions
0
votes
1 answer

fgets and chdir acting strangely together in C

I am currently creating a simple shell for homework and I've run into a problem. Here is a snippet of code with the pieces that pertain to the problem (I may have forgotten some pieces please tell me if you see anything missing): eatWrd returns the…
quigs
  • 23
  • 5
0
votes
1 answer

perl: chdir in perl and call chdir from system

In my perl script, use chdir command from Perl iteself works well as following: chdir $fold_path but use qx call chdir command of linux doesn't work as following: qx(chdir $fold_path) so what is the reason? Not so clear!
Chris Bao
  • 2,418
  • 8
  • 35
  • 62
0
votes
1 answer

How to change base directory for PHP include() / require()

Let's say my document root dir is /root and in that directory I have my index.php, plus two subdirs called branch1 and branch 2. Both branch1 and branch2 have include files, one of which must be included based on one or more conditional statements.…
0
votes
1 answer

GetAttributes uses wrong working directory in subthread

I used File::Find to traverse a directory tree and Win32::File's GetAttributes function to look at the attributes of files found in it. This worked in a single-threaded program. Then I moved the directory traversal into a separate thread, and it…
user2404501
0
votes
2 answers

How to change a directory in perl?

I'm not able to change the dir in perl. #!/usr/bin/perl use strict; my $dir=`date +%d%b%Y`; #the output of $dir is 13Feb2014 that directory is already inside "/mnt/Recordings/Inbound/Kinrep/" my $path = "/mnt/Recordings/Inbound/Kinrep/$dir"; …
user2932003
  • 171
  • 2
  • 4
  • 14
0
votes
2 answers

My chdir() function will not work. Why?

I am writing a program that asks the user for a linux bash command and then stores them in pointer arrays (kind of like char *argv[]). The program must then make a check if this command is a normal bash command or a cd (change directory) command. If…
Arman Iqbal
  • 725
  • 2
  • 8
  • 14
0
votes
1 answer

Unix Shell in C - Change Directory

I'm another CS beginner working on a simple Shell. At the moment I am trying to change the current directory if an argument is passed, else, report to the current directory. I tried using chdir() in my program, but it's apparently not working. I…
Gus
  • 215
  • 1
  • 6
  • 16
0
votes
1 answer

chdir() function fails when given a path with a PHP_EOL

I have some PHP Code and I am getting an Error when I use chdir to work with Hebrew file names: function GetSubFoldersArray() { $subFoldersArr = array(); $yourStartingPath = "images"; $iterator = new RecursiveIteratorIterator( …
Alex Batt
  • 65
  • 1
  • 2
  • 8
0
votes
1 answer

chdir() in C++ Getting Errors

I am trying to run a minimal terminal shell program through a socket on a unix machine. When I use system("cd directory") it doesn't work. So I did a bit of research and came across chdir(), which looked like it would work. When I tried it, though,…
jamespick
  • 1,974
  • 3
  • 23
  • 45
0
votes
1 answer

PHP - chdir() save the new directory

I'm working with chdir() and it's my first time and I'm having problems when I change the directory. Well, when I change the directory I use chdir(directory_name); but then when I check for the current directory or if I try to access to another…
user2088019
0
votes
1 answer

Trying to read files from a directory into PHP script

I've been trying to get my php script to read a directory for specific files and run the script on each, but I can't get it to work. I keep getting an error failed to open directory. I'm wondering if there is a small mistake I've made, and I've been…
ValleyDigital
  • 1,460
  • 4
  • 21
  • 37
0
votes
3 answers

Why is chdir() not successful?

I am coding a basic shell and my first requirement is to test for cd, I have all my conditions for the possible cd commands, after which, I will handing commands like ls. As for now I am really confused about one block of code. #include…
user2045236
  • 23
  • 1
  • 4
0
votes
0 answers

Is it okay to use chdir() in a shutdown function?

I noticed my Autoloader was not working properly on destructors (after die;), because PHP changes the current directory on shutting down. was: D:\www\arsenal got changed to: C:\wamp\bin\apache\Apache2.2.21 I don't even know why it does that. I…
Hugo Mota
  • 11,200
  • 9
  • 42
  • 60
0
votes
3 answers

Change Current Directory in Windows command environment

Seems it's not easy, I don't want to create a bat call an exe to do that. Is there a method to create a windows exe, that can change the current directory when it exit.
zhongshu
  • 7,748
  • 8
  • 41
  • 54
0
votes
0 answers

Changing a directory to a subdirectory specified by the User

I need to change the directory on the server to a subdirectory on the server, but it has to be specified by the client. I've tried numerous ways to try and get this working properly but no solution. Any tips would be appreciated.