Find the answer to your Linux question:
Results 1 to 10 of 10
I want to make I directory with the '/' prepended in it's name ie if i created a dir vickey before now i would like to create the same dir ...
  1. #1
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    mkdir with /dirname prepended

    I want to make I directory with the '/' prepended in it's name ie if i created a dir vickey before now i would like to create the same dir with '/' prepended now. How do i accomplish that ??
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  2. #2
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    Its not possible, because "/" is not allowed in file/directory name
    but "\" is allowed.
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  3. #3
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    isn't there any way to name it like that??
    like this mkdir \/directory ..
    I tried like that but it creates the dir in the /
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  4. #4
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    what is exact usage if '\' in naming dir/file???
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  5. #5
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    '\' is used to ovverride the meaning of a character or symbol.
    e.g.
    If you type command
    $ mkdir Audio Projects
    It will create 2 directories, Audio and Projects
    to ovverride meaning of space and use it as character '\' is added.
    $ mkdir Audio\ Projects
    Which will create one directory of name 'Audio Project'
    same way $ mkdir "Audio Projects"
    However '\/' reverse slashing wont work, / is not allowed in any file/folder name.
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  6. #6
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    hey posting after a long time!!
    I opened the man page of cd . There is a option -L , just few lines above that I see a statement which says "If dir begins with a slash(/).....". Now this means that dir can have a '/' prepended .
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  7. #7
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Not really. Read it carefully:

    If the directory operand begins with a slash character
    The directory operand is just that, an operand specified on the command line. Slashes can be used on that operand, but they have a special meaning. What you want to do is simply impossible as far as I know at file system level. So it doesn't really matter which useland tools you use, Linux won't let you this. That is, unless you are willing to do some -I suspect very heavy- patching on your kernel sources.

  8. #8
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    thanks for replying
    I use RHEL5 and the man pages say exactly as what I have posted. Which OS are you using??
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  9. #9
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by vickey_20 View Post
    thanks for replying
    I use RHEL5 and the man pages say exactly as what I have posted. Which OS are you using??
    I use Gentoo. Maybe we just have different versions of the man page. But in any case, you can't use / in a file or directory name.

  10. #10
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    Man pages are mostly not different but basic linux things are nearly same in all distros.
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...