Score:1

mkdir: cannot create directory

cg flag

Hello I have the following bash code:

#!/bin/bash

arr=( "$@" )


echo "${arr[1]}"
echo "${arr[3]}"
echo "${arr[2]}"

mkdir "${arr[1]}/segments"

echo `pwd`
cd "${arr[1]}/segments"

mkdir "${arr[1]}/segments/${arr[3]}/segment_${arr[2]}"
cd "${arr[3]}/segment_${arr[2]}"

echo `pwd`

read -p "aa: " cuvant

The echos are for me to understand what exactly is going on. I spitted the "mkdir" command in order to see if it is creating a folder or not. The outcome of the script is:

enter image description here

As you can see is not creating the other folder underneath the streams folder.

I have also a similar code that is actually doing the work:

mkdir "${arr[1]}_720_directory"
                ffmpeg -i ${arr[1]} -vf scale=1280:720 -preset slow -crf 18 "${arr[1]}_720_directory/output.mp4"
                arr1=("${arr[1]}_720_directory/output.mp4" "$resolution" )
                bash "$path"/check_resolution_video.sh "${arr1[@]}"
                bash "$path"/bitrate.sh "${arr[1]}_720_directory" "output.mp4" "${arr[0]}" "$path"

This code is calling another file which is creating different bit-rates and that file will call the script which is not working.

The result:

enter image description here

Here is the segments folder and the new folder that was created.

In this case I do not know what can be the actual error of the "mkdir" command. If you have any suggestion just let me know please.

hr flag
If you're trying to create a directory *including its parent directories* (it's really hard to tell from your question tbh) then you need `mkdir -p`
ilie alexandru avatar
cg flag
Thank you ! I am trying this and I will be back. I am trying to create
ilie alexandru avatar
cg flag
@steeldriver Thank you so much! Is working!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.