Questions tagged [cwd]

Cool Web Design CWD is global benchmark and source of design inspiration for web designers

Cool Web Design CWD is global benchmark and source of design inspiration for web designers

57 questions
43
votes
5 answers

How do I write a decorator that restores the cwd?

How do I write a decorator that restores the current working directory to what it was before the decorated function was called? In other words, if I use the decorator on a function that does an os.chdir(), the cwd will not be changed after the…
Daryl Spitzer
  • 143,156
  • 76
  • 154
  • 173
20
votes
2 answers

Is there a hook in Bash to find out when the cwd changes?

I am usually using zsh, which provides the chpwd() hook. That is: If the cwd is changed by the cd builtin, zsh automatically calls the method chpwd() if it exists. This allows to set up variables and aliases which depend on the cwd. Now I want to…
Stefan Majewsky
  • 5,427
  • 2
  • 28
  • 51
16
votes
4 answers

How to change the current working directory in Groovy

Now, I am writting a Groovy script to invoke other's interface. But I need change my current working path when running the script. I know it is not possible in Java. Is it possible in Groovy?
Joe
  • 223
  • 1
  • 2
  • 6
11
votes
1 answer

subprocess.Popen using relative paths

The docs for Popen mention that you can't specify your executable path relative to the 'change working directory' kwarg. If cwd is not None, the child’s current directory will be changed to cwd before it is executed. Note that this directory is…
wim
  • 338,267
  • 99
  • 616
  • 750
5
votes
2 answers

Vim, exit at current files location

I run Vim and change my current location all the time via shortcuts. Then when I exit Vim, I want to be in the directory of the file I was in, in the bash shell. How do I go about doing that?
john-jones
  • 7,490
  • 18
  • 53
  • 86
5
votes
4 answers

Python ftp list only directories and not files

I would like to list all directories on a ftp directory and then enter each of them. The problem is that my code also list file and try to enter them as well. Is there a way to get a return value from the method ftp.cwd ? Is there a way to get…
yossi
  • 12,945
  • 28
  • 84
  • 110
5
votes
2 answers

Is it possible to exclude '.' (ie. current dir) from PHP's include path?

From perusing the comments at http://php.net/manual/en/function.set-include-path.php , it seems to me that '.', or rather basename(__FILE__), is always implicitly added to PHP's include path. Is it at all possible to bypass this path? In my work…
Emanuel Landeholm
  • 1,396
  • 1
  • 15
  • 21
5
votes
1 answer

CWD of an Node.js application started with upstart (Ubuntu)

I've coded an node.js app that when get executed need to return CWD from process to be able to read files on disk. When I start the app directly with node in the actual app directory... #!sh node app.js everything is working fine and…
plehoux
  • 795
  • 2
  • 8
  • 21
4
votes
2 answers

Using Perl on Windows, how can I ensure I get the path in the correct case following a chdir?

Consider the following code: print cwd . "\n"; $str= "../source"; # note the lower case 's' chdir($str); print cwd . "\n"; If my current directory is c:\parentdir\Source (note the capital 'S'), the output of this will…
Craig
  • 855
  • 1
  • 9
  • 14
4
votes
3 answers

Accessing files in the same directory as script

I need to access files that are relative to the location of my Ruby script. The only solution I've found is using File.dirname(__FILE__), however, if the script is run from a symlink, __FILE__ gives the location of the symlink. I would prefer a…
Jeffrey Aylesworth
  • 8,242
  • 9
  • 40
  • 57
3
votes
1 answer

Saving and sending back files elegantly with blueprints/config

I have the following file structure: . ├── app │   ├── api_routes │   │   ├── forms.py │   │   ├── __init__.py │   │   └── routes.py │   ├── __init__.py │   ├── main_routes │   │   ├── forms.py │   │   ├── __init__.py │   │   └── routes.py │   ├──…
Joost
  • 3,609
  • 2
  • 12
  • 29
2
votes
2 answers

Perl getcwd ending forward slashes

I am doing a Perl script to attach another variable to the end of the current working directory, but I am having problems with using the module. If I run getcwd from D:\, the value returned is D:/ (with forward slash) If I run getcwd from…
Andy
  • 2,770
  • 9
  • 35
  • 42
2
votes
1 answer

python subprocess.run with working directory changed by cwd is not working

I am trying to use python subprocess to call an exe. The application usually takes the parameter file from the same directory as exe. However, as the python file is not located at the same directory as exe, the exe cannot find the parameter file…
Roy Dai
  • 483
  • 2
  • 5
  • 15
2
votes
1 answer

Combining Multiple CSV files with Python

I am trying to combine multiple csv files into 1 csv file in a python script. I want to skip writing the first 5 lines of each csv file. Having some trouble and I am new to Python. I have tried several examples that I have found but it seems to…
Paul
  • 21
  • 1
2
votes
3 answers

C++ Get Application Directory *NIX

How can I get the application directory in C++ on Linux/Unix. getcwd() returns the directory from which the application was run, but I want the actual directory which the build is sitting in. I know you can get this from the main() but I dont really…
user245019
1
2 3 4