Project

General

Profile

Using CDO when spaces exist in file paths?

Added by Robert Wilson almost 3 years ago

Is there a way to use CDO when file paths have spaces in them? I always avoid them, but I'm working with a lot of data that has them.

The following does not work when I try it:

cdo timmean "foo foo.nc" out.nc

This seems to be parsed by CDO as

cdo timmean [foo foo.nc] out.nc

Is there a work around for this?

Regards

Robert


Replies (5)

RE: Using CDO when spaces exist in file paths? - Added by Estanislao Gavilan almost 3 years ago

Hi Robert,

I tried different choices without success. I recommend to write a simple script where your can make a list with the name of the folders like

path_folder=`pwd`'/'*
for x in $path_folder;
do
if [ -d "${x}" ]; then
echo ${x}
cd x
cdo blablabla.nc pepe.nc
fi
done
Kind regards,

Estanislao

RE: Using CDO when spaces exist in file paths? - Added by Ralf Mueller almost 3 years ago

@Robert this behavior is standard shell handling of quoted stings. thats why cdo does handles "foo foo.nc" as a single thing. The question for me is more like: Why do you want to do something like this? Do you use blank in file names?

cheers
ralf

RE: Using CDO when spaces exist in file paths? - Added by Matthias Sänger 6 months ago

I think the question was: Can a path with spaces be used with cdo.

cdo info path with spaces/foo.grib2

I have tried single/double quotes and escaped the spaces without success.
Best regards

RE: Using CDO when spaces exist in file paths? - Added by Karin Meier-Fleischer 6 months ago

The only way is to mask the blank character within the string with the \.

cdo info path\ with\ spaces/foo.grib2

RE: Using CDO when spaces exist in file paths? - Added by Matthias Sänger 6 months ago

Thank you for your swift reply.
I tried this already. I get the following error.

cdo    info: Open failed on >path<
             Is a directory

CDO version 2.0.4, Copyright (C) 2003-2022 MPI für Meteorologie

Unfortunately, I cannot work with symlinks which would be a feasible option.

    (1-5/5)