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
1
vote
1 answer

os.chdir to a directory containing spaces/commas in its name

I faced a trouble. I have several directories then I need to cd to using os.chdir. But I keep getting errors in the next chunk of code: import os new_folder = 'Zarazogic acid A' os.chdir(new_folder) FileNotFoundError: [Errno 2] No such file or…
Akado2009
  • 381
  • 1
  • 4
  • 11
1
vote
2 answers

Deleting files in higher directory

I'm having problems deleting a file from a higher directory, I found this post and tried it but no luck....: gotdalife at gmail dot com 25-Sep-2008 02:04 To anyone who's had a problem with the permissions denied error, it's sometimes caused…
alsweet
  • 633
  • 1
  • 12
  • 26
1
vote
2 answers

Current directory path in python changed in the class

I change the directory in the dirStuff.findFileInDir function, but when I print out the current working directory in jsonParsing.printDirtyJSON it gives me the (new) directory I changed to. I thought classes were self-contained. I want the path to…
Kashif Iqbal
  • 153
  • 9
1
vote
2 answers

chdir doesn't work in c

I have a father process and a child process, the second created with fork, the child receive from the father a char s[] (s can be something like "cd Music" ), i extract Music from "cd Music" using strtok, but when chdir(dir) executes i get "No such…
Daniel
  • 11
  • 2
1
vote
1 answer

os.Chdir("/tmp") works abnormally in Go

I used Macbook. I tried to use os.Chdir("/tmp") but the outcome was /private/tmp. Following is my code: package main import ( "fmt" "os" ) func main() { s, _ := os.Getwd() fmt.Println(s) if err := os.Chdir("/tmp"); err != nil { …
waitingkuo
  • 89,478
  • 28
  • 112
  • 118
1
vote
1 answer

Find the right path with os.chdir() in digital ocean

I tried several ways but never succeeded. I need to change the directory in digital ocean (/home/vagrant). I have files saved in the same folder as where the file.py file is. file.py and other files that file.py aims to execute are all in…
yearntolearn
  • 1,064
  • 2
  • 17
  • 36
1
vote
2 answers

awk output to variable and change directory

In the below script. am not able to change the directory.i need the output like above 70% disk inside that directory which one is consuming more space. #!/usr/bin/perl use strict; use warnings; my $test=qx("df -h |awk \+\$5>=70 {print \$6}…
1
vote
2 answers

PHP - chdir and require fail

I've a problem with a simple chdir and require. From a first file : web/index_cluster.php I'm trying to load a second one : ezpublish_legacy/index_cluster.php My required file do not load but I've no clue why... Here's my config. PHP…
Adcaelo
  • 19
  • 5
1
vote
1 answer

Using Current Directory to retrieve data without opening Excel Workbook (Smarter Selective Imports w/VBA)

(Excel 2010) I'm trying to grab specific lines from a variety of "target" workbooks in different but similar folders. I have found that I am able to pull this data when the source ("LM", the workbook the code is executing in, and that I want to pull…
basaltanglia
  • 793
  • 1
  • 6
  • 12
1
vote
1 answer

How to set current drive with GCC C?

Is there a c function in Gcc to set current drive (not just directory/folder). chdir() changes folder but I need to set the "active" drive (as in C:, D: etc.) Some compilers have _dos_setdrive() and chdrive() and Windows has its own but I could not…
user1231247
  • 193
  • 1
  • 8
1
vote
1 answer

POSIX/C: chdir() not changing the directory with spaces?

I am trying to develop a shell in C/POSIX on my Mac OS X. For the cd command, I can successfully change the directory of the shell with the chdir method in most cases except when the path has spaces in it. For example, a path such…
Jenna Maiz
  • 792
  • 4
  • 17
  • 38
1
vote
7 answers

c++ - Splitting an absolute file path

I'm writing a C++ program for a school assignment. At some point, the question requires me to change directories, which I know how to do. However, the user will provide the program with the absolute path of a file. What I'm trying to do is to change…
The_Questioner
  • 240
  • 2
  • 7
  • 17
1
vote
1 answer

Force Delphi to open a project with chdir the project's dir

I have Delphi 6 prof, with Win7. We have many projects. Some of them are favourites, commonly used/edited. Formerly I used GExperts' fav. files that is shown in "Open dialog" for this. But this is vanished with Win7. The main problem that Delphi…
durumdara
  • 3,411
  • 4
  • 43
  • 71
1
vote
3 answers

cd using empty string inconsistencies

According to "chdir" xopen specification, using an empty string ("") as argument should results in an error (enoent): [ENOENT] A component of path does not name an existing directory or path is an empty string. I've checked many different…
Gilles Pion
  • 166
  • 1
  • 8
1
vote
2 answers

Using wildcards in Dir.chdir - ruby?

I have a directory structure, for example like this: +SOURCE_CODE + MODULE_A -myfile.txt + MODULE_B -myfile.txt + MODULE_C -myfile.txt Now I would like to do "Dir.chdir" into each…
JohnDoe
  • 825
  • 1
  • 13
  • 31