I am using a program called Diamond and I have a script that goes like this:

cd /srv/scratch/myname/hello
diamond blastp -d /srv/scratch/myname/goodbye/inputFile1.dmnd -q inputFile2.faa -o /diamond/outputFile.txt
I have my inputFile2.faa in the working directory (/srv/scratch/myname/hello) and I have my other inputFile1.dmnd in another directory. As inputFile1.dmnd is a massive file and is being used in other command lines I do not want to move it to my current working directory as this would be impractical.

When I run this command line I get 'No such file or directory'.  Is there a way to specify the absolute/relative path so I can keep my inputFile1.dmnd in a neutral directory?

I expect the answer to that question will help me with this one too but with my outputFile.txt.  I also want to specify which directory to put it in relative to my working directory; is there a way to do that?

  • 2
    What is the full error message? – Kusalananda May 25 '19 at 6:59
  • diamond v0.9.24.125 | by Benjamin Buchfink <buchfink@gmail.com> Licensed under the GNU GPL <gnu.org/licenses/gpl.txt> Check github.com/bbuchfink/diamond for updates. #CPU threads: 16 Scoring parameters: (Matrix=BLOSUM62 Lambda=0.267 K=0.041 Penalties=11/1) No such file or directory – gwrathe May 25 '19 at 7:10
  • 1
    Is both the files /srv/scratch/myname/goodbye/inputFile1.dmnd, /srv/scratch/myname/hello/inputFile2.faa, and the directory /diamond available (are you able to ls them)? Are you running this as a job on a cluster with something like Slurm? If so, are the file and directory available on the compute node running the job? – Kusalananda May 25 '19 at 7:16
  • Are you sure the error is not about inputFile2.faa? – Rui F Ribeiro May 25 '19 at 7:18
  • Yep, I can ls both. Yes, it is being run on a cluster with a job scheduler. The files and directories are no less available than any others like the directory I cd'd to. I thought I might have simply not known how to do this but it looks like it's shaping up to be something I might talk to our HPC IT people about. – gwrathe May 25 '19 at 7:26

Assuming these are the real paths, the problem is most likely the character #.


1) Don't use # in file or directories names, if you can avoid it. So rename /srv/scratch/# to something else, like /srv/scratch/hash. You'll need escaping (see below) to do this.

2) Escape # with a backslash:

diamond blastp -d /srv/scratch/\#/goodbye/inputFile1.dmnd -q inputFile2.faa -o /diamond/outputFile.txt

3) Escape the complete filename with single quotes:

diamond blastp -d '/srv/scratch/#/goodbye/inputFile1.dmnd' -q inputFile2.faa -o /diamond/outputFile.txt

You can test all this by using a standard command like ls together with the filename, and optional bash tab completion (which will add escaping).

  • 2
    bash (for example) would have no issue with # when specified as part of a pathname like what the user is doing. – Kusalananda May 25 '19 at 7:01
  • I am using bash. I'm terribly sorry, I should have clarified, the # is just my name on my university's computer that I replaced to hide my identity. – gwrathe May 25 '19 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.