Linux-Noob Forums

Full Version: creating/removing filenames with spaces in them
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I was reading a doc about linux and figured out this trick, (i don't know if most of you know about it, so please don't flame me if you do :P).

Ok, you can create file/directory names in bash with spaces in them using ''.

e.g

Code:
[seeno@localhost seeno]$ mkdir 'file name'






Code:
[seeno@localhost seeno]$ pico 'text file'






Code:
[seeno@localhost seeno] rmdir 'file name'




... you get the picture ;p


Quote:I was reading a doc about linux and figured out this trick, (i don't know if most of you know about it, so please don't flame me if you do :P).Ok, you can create file/directory names in bash with spaces in them using ''.

e.g

Code:
[seeno@localhost seeno]$ mkdir 'file name'

<div>




Code:
[seeno@localhost seeno]$ pico 'text file'






Code:
[seeno@localhost seeno] rmdir 'file name'




... you get the picture ;p

</div>
 

I got to read this post by googling "spaces in Linux file names".

 

I also read the post that says that in terminal just start to type the first letters of the file name and use [tab]

and the file name is auto completed say the file is "My budget" it will complete it with the escape "\" like My\ budget.

 

that is good to. The problem with spaces in filenames is that some apps like yester day I was using an programming IDE that created with a wisard all the files and directories need for a costum app and some folders had spaces in it.

For creating every thing no problem. But when it came to compile the new app it did not put the "" around the filenames. nor did it put the \ so errors of compilation occurd saying that the path was not found.

 

So using spaces is a bad practice. so i had to change all the spaces to "-" and the compiler worked fine.

 

If some one has other solution let me know.

 

bye, Guy