touch: cannot touch file: No such file or directory

You do not have the path that holds the file:

/opt/tsrm/compliance/cme/log/

That's where the error come from.


Sounds like you misspelled the path. For example, this folder /stuff/more_stuff does not exist. This gives me the result:

user@linux:~ $ touch /stuff/more_stuff/stuff.file
touch: cannot touch `/stuff/more_stuff/stuff.file': No such file or directory

Both /stuff and /stuff/more_stuff need to exist in order for touch to work.


Yes there might be chances of miss typo or directory not exists .

LOGFILE="/opt/tsrm/compliance/cme/log/20121207.log"
LOG_DIR=`dirname $LOGFILE`
[ ! -d $LOG_DIR ] && mkdir -p $LOG_DIR
touch $LOGFILE