Skip to main content

All Questions

Tagged with
0 votes
2 answers
691 views

Creating nested directories

I want to write a bash script that will get a command line argument and create nested directories under the user home directory. E.g a/b/c mkdir -p $1/$2/$3 But I want create not just three levels ...
Խաչատուր Մելքոնյան's user avatar
1 vote
1 answer
99 views

Create a folder for each file in a folder without the folder itself

| folderA1 | fileA11, fileA12, ... folderA | folderA2 | fileA21, fileA22... | ... | ... I want to make a copy of it represented as: | folderA1 | folderA11, folderA12, ... ...
Pushpa's user avatar
  • 113
1 vote
1 answer
484 views

Fedora terminal script to create a directory and copy a file to directory

I need help to write a script to create a directory, so far I have mkdir ./directory. This would create a folder called Directory, but I need to make it ask if the user wants to copy a file called ...
Malcolm's user avatar
  • 11
2 votes
3 answers
3k views

Create file in subdirectories that doesn't exist (../new_folder/new_folder/new_file.ext)

For now i use this: mkdir -p a/b/c/d/e; touch a/b/c/d/e/file.abc; Is there more efficient ways?
TsV's user avatar
  • 131
0 votes
0 answers
55 views

Create multiple directories with -p option

Why does this command sudo mkdir -p \ /opt/nginx/conf.d \ /opt/gitlab/config throw the error /opt/gitlab/config: File or directory not found. I'm expecting to create it. Also I used the -p flag.
user3142695's user avatar
  • 1,599
0 votes
2 answers
2k views

mkdir with seq command problem

I need to make 5 directories (name1, name2, name3, name4, name5) by command line using mkdir and seq. If I use: mkdir name{`seq -s , 1 5`} It results in one directory: name{1,2,3,4,5} What ...
deebian's user avatar
  • 11
71 votes
1 answer
102k views

How to create a file and parent directories in one command? [duplicate]

Is there a flag/option for touch, mkdir, >, or some other command that will allow me to create a file and any non-existent parent directories at the same time? For instance, let's say I'm in an ...
Jeff Puckett's user avatar
6 votes
2 answers
11k views

Make parent directories while creating a new file

I am aware of the fact that mkdir -p /path/to/new/directory will create a new directory, along with parent directory (if needed ). If I have to create a new file, along with it's parent directories (...
Mandar Shinde's user avatar
4 votes
4 answers
2k views

Make many subdirectories at once

Suppose I have a directory /, and it contains many directories /mydir, /hisdir, /herdir, and each of those need to have a similar structure. For each directory in /, there needs to be a directory doc ...
2mac's user avatar
  • 1,035