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
2 answers

Excel VBA ChDir will not change my directory

I am trying to have a user file selection box automatically open up to a directory. Everything works fine, but instead of opening to the correct directory, I still have to click through to the right one. My code is as follows. ChDir ("\\file path…
0
votes
1 answer

How to always execute PyInstaller / Platypus compiled Python executable in the directory where it is located

I have a python script that needs to be executed from within the folder where it is located. I am distributing it as PyInstaller compiled executable (wrapped into an AppImage for Linux). I will probably migrate to Platypus for OSX, so that I get a…
Tom Atix
  • 381
  • 1
  • 21
0
votes
1 answer

Extract pdfs from a directory and output images to a different directory with pdf2image

I'm trying to read in some pdfs located in a directory, and outputting images of their pages in a different directory. (I'm seeking to learn how this code works and I am hoping there's a cleaner way to specify an output directory for my image…
0
votes
0 answers

chdir gives different outputs using function in a WINDOWS environment

I want to program a function which easy check if the path variable is correct or if it includes a missing path. That is what I got: C:>CheckPath PATH[ 0]="C:\Program Files (x86)\Common Files\Oracle\Java\javapath" ok PATH[…
0
votes
1 answer

Creating new laravel project and this error came up

Creating new laravel project and this error came up [ErrorException] chdir(): No such file or directory (errno 2)
0
votes
1 answer

how to make `cd` call in Rust?

I'm writing a command-line tool using Rust. I want to cd to the wanted dictionary when I execute my Rust command-line tool. I use env::set_current_dir(path), but it does not work. After that, I use nix, call nix::unistd::chdir(path), but it does not…
Parker
  • 3
  • 1
  • 3
0
votes
2 answers

Renaming files in a folder with pathlib and for loops

I've written the following renaming tool in Python. It was unintentionally moving all my files to a single directory until I added the os.chdir in my for loop, which then made it work better and keep each renamed file inside its correct folder. But…
Dude
  • 145
  • 1
  • 9
0
votes
3 answers

Perl chdir fails with a glob pattern

I am trying to do cd in my perl script. I am using the below command: chdir "/home/test/test1/test2/perl*"; perl* value is actually perl_0122_2044, but this value may vary. The above chdir command is not doing cd to the path. Am I doing something…
Paul IT
  • 85
  • 5
0
votes
3 answers

Access a file even if the cwd has changed

The below code works perfectly: with open('data.txt') as data: print(data) But if I changed the CWD using os.chdir, It won't work Is there a way in which I can access the file while still being able to change the CWD? Note: The way the CWD will…
0
votes
4 answers

Why files get deleted when i rename them using this python script?

I created this program to rename all my random wallpapers names to wallpaper1, wallpaper2 and so on by using this code: import os path = os.chdir("/home/samipkarki/Pictures/Wallpapers") value = 1 for file in os.listdir("path"): new_filename =…
user13626513
0
votes
0 answers

Can’t change directory in package.json

I have a line in my package.json "deploy": "yarn build && cd ../../.. build script that should change directory (cd ../../..) after running the first command (yarn build). However, this doesn't seem to trigger changing directory to the root of the…
user3438917
  • 417
  • 1
  • 7
  • 26
0
votes
3 answers

Access directory anywhere using CD in Command Prompt (Windows)

I want to access a directory using the CHDIR (CD) command in CMD without typing the entire path. For example: C:\Program Files> cd Coding And then, the result I want is: C:\Users\Shadow\Documents\Coding> Is it possible to be done? If yes, how can…
0
votes
1 answer

php @chdir file not found

moved server hosts, the below used to work but now just get file not found $cwd = getcwd(); @chdir($_SERVER['DOCUMENT_ROOT'] . '/avobb/'); include_once('./global.php'); chdir($cwd); running FPM/FastCGI 7.3.17 path to global.php…
0
votes
1 answer

VBA export as jpg

I managed to implement code that exports as JPG using charts. However, when I try to change the file export path, the Error I get is Run-time error 1004: Method "Range object"_Global failed I don't understand what the code is not reading as paths…
0
votes
2 answers

How to change the current directory to a designated directory using chdir() in c?

EDIT The existed directory is not necessarily a sub-directory of the home directory. It can be a sub-directory of a sub-directory of the home directory. End of EDIT I am reading a user input (e.g., cd existedDirectory) to change the current…
gsk
  • 107
  • 11