1

I want to run some files within a directory (mike1). I have to use an executable file that is in another directory(Zacros). How can I do it? The software's manual says: "Zacros expects all the right input files to be in the current directory"

I have checked and all the files are in mike1/100

From the command prompt I have tried the following:

cd Zacros
cd build
./zacros.x

Result: WITH THREADS 2 STOP 1 It works!

The problem begins when I add the path to the folders I want the executable file to read.

  cd Zacros
cd build
./zacros.x /mike1/100

Error: got mike1/100 which is not valid.

Thanks!

4
  • Is the executable file in the directory you were in before doing cd mike1? what is its name (zacros? zacros.x?) Oct 10, 2019 at 17:08
  • Before cd mike1 I was in the command prompt. The executable "zacros.x" is in the "Zacros" directory. Oct 10, 2019 at 17:17
  • @user3689783 that makes no sense. you are not showing a Zacros directory in your question.
    – Rinzwind
    Oct 10, 2019 at 18:03
  • This is wrong "Error: got mike1/100 which is not valid." "./zacros.x /mike1/100" would return "Error: got /mike1/100 which is not valid." It would have the / in the error notice.
    – Rinzwind
    Oct 10, 2019 at 18:07

2 Answers 2

0

First, cd to the directory you want to be in:

cd mike1

Then use the relative path, like this:

../build/zacros.x

Note, the ".." means one directory up from where you are.

3
  • Once in mike1 I typed what you suggested and it displayed " no such file or directory". When I go to cd Zacros Oct 10, 2019 at 18:27
  • what does the output look like if you type "ls -l " from your home dir? Oct 10, 2019 at 18:51
  • There are some directories including "Zacros" (where the .x file is) and "mike1" (where the folder "100" is) Oct 10, 2019 at 19:14
0
mike1/100/./zacros.x

is invalid. The . goes at the FRONT of the command if you are at the directory where mike1 is in.

./mike1/100/zacros.x

When zacros.x is inside /100 and you are 1 dir lower you do

cd mike1/100
../zacros.x

If it is inside mike1 (so you are 2 dirs lower):

../../zacros.x

You can also do

../../mike1/100/zacros.x

if you are 2 directories deep and need to go into 2 other directories.

edit

cd build
./zacros.x /mike1/100

why do you put a / in front of mike1? The system will try to find it at the root of the filesystem. Please point to it relatively from the dir Zacros: use ../mike1/100 to go 1 up from Zacros or mike1/100 if you have mike1 in Zacros.


Let me clarify, here is the executable: Zacros/build/zacros.x, the files are in the following directory: mike1/100/. If I type what you suggested: cd build ./zacros.x /mike/100, it says it is not valid.

If those are relative paths from the beginning:

cd Zacros/build/
./zavros.x ../../mike1/100/

could be what it need to be. But that is assuming those 2 are in the same directory.

2
  • Thanks. Let me clarify, here is the executable: Zacros/build/zacros.x, the files are in the following directory: mike1/100/. If I type what you suggested: cd build ./zacros.x /mike/100, it says it is not valid. Oct 10, 2019 at 18:13
  • please add the result of 'tree' from the root of your project into the question
    – Rinzwind
    Oct 11, 2019 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .