Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
creating/removing filenames with spaces in them
#1

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

Reply
#2

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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)