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
3
votes
3 answers

Perl chdir doesn't work

A previous post might be useful: Perl system() call failed with return code 65280 Again, I've used this code many times, but it doesn't work here. I've moved all other perl instances from PATH. Source: $targetDir = "M\:\\bldforge_AOMS_DEV"; print…
Alex
  • 180
  • 2
  • 3
  • 10
2
votes
1 answer

Ruby: Dir.chdir using data from a text file in windows

I am trying to use a script to change the working directory using Dir.chdir This works: dirs = ['//servername/share','//servername2/share'] dirs.each do |dir| Dir.chdir dir end If I put the above share information into a text file (each share on…
Neil Hoff
  • 2,025
  • 4
  • 29
  • 53
2
votes
3 answers

Passing a variable to chdir() in C (Linux)

I'm having a problem with chdir() in my C program - only when running on Linux (works fine on Mac). I've stripped down my code. Something like this works fine: chdir("/Documents"); but when I try to pass it as a variable it doesn't want to work.…
user1038788
2
votes
1 answer

Using chdir to change working directory in c

I'm fairly new to C,and seem to have hit a wall. Am I passing this argument to change working directory whenever someone types in cd directory correctly? If I don't include a directory, it defaults to reporting the present working directory, but I…
Ryan
  • 193
  • 2
  • 2
  • 14
2
votes
2 answers

Calling Python Script from VBA - Not working

I referred to the answers given here - How to call python script on excel vba? But it didn't work for me. I simply see a screen flash before me and the Python script simply does not run. The Python Script I am writing is in Spyder, and has multiple…
2
votes
0 answers

How to use chdir() in Maxima in a more flexible way?

I often put the following lines at the beginning of my Maxima files load("operatingsystem")$ chdir("/Users/tilda/Documents/progs/maxima/spm/")$ to make sure that output created by other programs from within Maxima is written into the current…
2
votes
1 answer

chdir in perl using two strings: chdir "/home/$dir1/$dir2"

I have two strings: $dir1 and $dir2. I want to use chdir as shown below: chdir "/home/$dir1/$dir2"; when I try this it doesn't change the directory. I checked the current working directory same as before Is there any way to do this?
techie
  • 59
  • 5
2
votes
2 answers

C, Linux, getcwd/chdir(): get binary path

I want to open a number of files (log4cxx configs, other logs etc) relative to binary's location. Unfortunately, both getwd() and getcwd() are giving me the directory, from which I try to run binary at known path, instead of giving me the path where…
kagali-san
  • 2,964
  • 7
  • 48
  • 87
2
votes
2 answers

Documentation describing this python windows os.chdir behavior?

I learned today that in python on windows, doing os.chdir('f:\\') is very different than doing os.chdir('f:'). The command with the trailing backslash actually changes the current directory. Without the backslash, the command is like typing f: in…
aggieNick02
  • 2,557
  • 2
  • 23
  • 36
2
votes
1 answer

Strange (internal?) default constructor error message using chdir in Perl 6 REPL

I'm facing the following error: &*chdir('/home/account') Failed to change the working directory to '/home/account': Default constructor for 'IO::Path' only takes named arguments What do I need to change to overcome this error? (I am using…
branco
  • 142
  • 9
2
votes
1 answer

Unexpected print() and os.listdir() functionality

import os target_dir = "xxx.xxx.xx.xx/path/to/file/dir" start_seq = "*** Start Sequence ***" end_seq = "*** End Sequence ***" def tp_parser(file): with open(file) as in_f: lines = in_f.readlines() f_name = in_f.name[12:16] …
blackmore5
  • 73
  • 1
  • 6
2
votes
1 answer

Display and delete files from subfolders based on select value

My folder structure has 4 layers with my form in the top layer, currently it displays the files in the top layer only, I want to be able to select a subfolder and display the files in it so they can be deleted if…
Kilisi
  • 402
  • 11
  • 33
2
votes
1 answer

C Segfault in readdir after chdir

I am having a weird issue with this C program I'm writing to loop through a directory and open each file to do some work on. My program is located in the parent directory of the directory I'm searching through. In order for fopen to be able to see…
2
votes
2 answers

python3 chdir() does not seem to work

As an newcomer to python I figured I'd write a little python3 script to help me switch directories on the command line (ubuntu trusty). Unfortunately os.chdir() does not seems to work. I've tried tinkering with it in various ways such as placing…
sabot
  • 33
  • 5
2
votes
2 answers

Using chdir() to change directory from Terminal

I am using chdir() to change directory to the value passed as an argument to this function. I understand that when I run my C program using gcc myCd.c and ./a.out .. this changes the directory to the parent directory "within" the C program (i.e. a…
ATP
  • 832
  • 1
  • 15
  • 29
1 2
3
13 14