ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Can't Change to Directory in Ubuntu

    IT Discussion
    8
    28
    4.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lanceL
      lance @thanksajdotcom
      last edited by

      @thanksajdotcom No problem, hopefully it works for you. Those darn hyphens can cause issues sometimes...

      1 Reply Last reply Reply Quote 0
      • thanksajdotcomT
        thanksajdotcom
        last edited by

        Ok, got it! Syntax is as follows:

        cd -- -.MP3.-
        

        Thanks!

        lanceL 1 Reply Last reply Reply Quote 0
        • thanksajdotcomT
          thanksajdotcom
          last edited by

          Credit goes here: http://linuxers.org/quick-tips/how-open-directory-or-file-starting-hyphen

          1 Reply Last reply Reply Quote 0
          • coliverC
            coliver
            last edited by coliver

            Have you tried using cd against the entire path? Or the parent path? either

             cd ../folder/-.MP3.-
            

            or

             cd /parentfoldertree/-.MP3.-
            

            Or you could try it with absolute quotes

             cd '-.MP3.-'
            
            thanksajdotcomT 1 Reply Last reply Reply Quote 0
            • thanksajdotcomT
              thanksajdotcom @coliver
              last edited by thanksajdotcom

              @coliver said:

              Have you tried using cd against the entire path? Or the parent path? either

               cd ../folder/-.MP3.-
              

              Or you could try it with absolute quotes

               cd '-.MP3.-'
              

              Tried it with the quotes. That didn't work. If I go up a level and then do this, it works as well...

              cd Music/-.MP3.-
              

              Thanks for the suggestion!

              1 Reply Last reply Reply Quote 0
              • coliverC
                coliver
                last edited by

                Tab completion may also have made this easier. Not sure though.

                thanksajdotcomT 1 Reply Last reply Reply Quote 1
                • lanceL
                  lance @thanksajdotcom
                  last edited by

                  @thanksajdotcom said:

                  Ok, got it! Syntax is as follows:

                  cd -- -.MP3.-
                  

                  Thanks!

                  Awesome! I knew it was something like that... It's been awhile since I ran into that.

                  thanksajdotcomT 1 Reply Last reply Reply Quote 0
                  • thanksajdotcomT
                    thanksajdotcom @coliver
                    last edited by

                    @coliver said:

                    Tab completion may also have made this easier. Not sure though.

                    Nope, it didn't. Tried that too.

                    1 Reply Last reply Reply Quote 0
                    • thanksajdotcomT
                      thanksajdotcom @lance
                      last edited by

                      @lance said:

                      @thanksajdotcom said:

                      Ok, got it! Syntax is as follows:

                      cd -- -.MP3.-
                      

                      Thanks!

                      Awesome! I knew it was something like that... It's been awhile since I ran into that.

                      Yeah, the file structure was originally designed to be accessed under Windows and I'd just never navigated to these directories under Linux until today. They still read the files inside fine. Just changing to it was a bit wonky. Lol

                      1 Reply Last reply Reply Quote 0
                      • tonyshowoffT
                        tonyshowoff
                        last edited by tonyshowoff

                        Also you can use backslashes, and in fact that's the more "proper" way to escape the characters.

                        cd \-.MP3.\-
                        

                        ...for example. Quotes may work slightly differently, or not at all, depending on what you're doing, so maybe get used to escaping things the other way. You can also make this behaviour happen automagically by hitting tab to autocomplete with some shells and it will auto escape required characters.

                        thanksajdotcomT 1 Reply Last reply Reply Quote 0
                        • thanksajdotcomT
                          thanksajdotcom @tonyshowoff
                          last edited by

                          @tonyshowoff said:

                          Also you can use backslashes, and in fact that's the more "proper" way to escape the characters.

                          cd \-.MP3.\-
                          

                          ...for example. Quotes may work slightly differently, or not at all, depending on what you're doing, so maybe get used to escaping things the other way. You can also make this behaviour happen automagically by hitting tab to autocomplete with some shells and it will auto escape required characters.

                          I tried that. That didn't work either.

                          1 Reply Last reply Reply Quote 0
                          • thanksajdotcomT
                            thanksajdotcom
                            last edited by

                            The two solutions are either...

                            cd Music/-.MP3.-
                            cd -- -.MP3.-
                            

                            Thanks,
                            A.J.

                            1 Reply Last reply Reply Quote 0
                            • tonyshowoffT
                              tonyshowoff
                              last edited by tonyshowoff

                              My fault, I forgot files starting with a hyphen are treated completely differently, but you can do this:

                              anton@c0:~$ mkdir -- -.MP3.-
                              anton@c0:~$ cd -- -.MP3.-
                              anton@c0:~/-.MP3.-$
                              

                              Or even

                              anton@c0:~$ mkdir ./-.MP3.-
                              anton@c0:~$ cd ./-.MP3.-
                              anton@c0:~/-.MP3.-$
                              

                              So you need not navigate from parent at all, you can do it from the working directory itself. Navigating from parent seems painful, but parents usually are a pain.

                              1 Reply Last reply Reply Quote 1
                              • tonyshowoffT
                                tonyshowoff
                                last edited by

                                Why is this directory named something so bizarre, by the way?

                                thanksajdotcomT 1 Reply Last reply Reply Quote 1
                                • thanksajdotcomT
                                  thanksajdotcom @tonyshowoff
                                  last edited by

                                  @tonyshowoff said:

                                  Why is this directory named something so bizarre, by the way?

                                  I didn't have any Linux systems connected to it when I named all these and I don't really have a reason, it's just how I named it at the time. I think these directories were originally part of a larger folder structure so I started the name with a dash to put them at the top and also so all the format folders would be grouped together.

                                  ? scottalanmillerS 2 Replies Last reply Reply Quote 0
                                  • thanksajdotcomT
                                    thanksajdotcom
                                    last edited by thanksajdotcom

                                    See examples:

                                    root@jump-server:<path removed># ls
                                    Amazon MP3  iTunes   -.MP3.-         Playlists  Unsorted Output
                                    Archive     -.OGG.-  _SYNCAPP   	 -.WAV.-    -.FLAC.-
                                    -.M4A.-     Picard Plugins  Temp     -.WMA.-
                                    

                                    upload-f5d241e6-b0b7-463e-a821-4f79efa6684d

                                    1 Reply Last reply Reply Quote 0
                                    • ?
                                      A Former User @thanksajdotcom
                                      last edited by

                                      @thanksajdotcom said:

                                      @tonyshowoff said:

                                      Why is this directory named something so bizarre, by the way?

                                      I didn't have any Linux systems connected to it when I named all these and I don't really have a reason, it's just how I named it at the time. I think these directories were originally part of a larger folder structure so I started the name with a dash to put them at the top and also so all the format folders would be grouped together.

                                      On Any OS that doesn't really make any sense. Underscores are normally used instead of spaces. but, a hyphen and period in a folder is a bit of a no-no.

                                      tonyshowoffT 1 Reply Last reply Reply Quote 0
                                      • tonyshowoffT
                                        tonyshowoff @A Former User
                                        last edited by

                                        @thecreativeone91 said:

                                        On Any OS that doesn't really make any sense. Underscores are normally used instead of spaces. but, a hyphen and period in a folder is a bit of a no-no.

                                        That or on shared space what we do is just put a ! in front of the name

                                        !mp3
                                        !ogg
                                        !wave
                                        

                                        This top sorts and and sets it apart and doesn't really break anything, though you do have to escape when cding to it when not using Windows, but that's easy and auto-tabbed. I mean I get prefixing the file name, but why with a period as well? And also why post fix it with another dot and period?

                                        thanksajdotcomT 1 Reply Last reply Reply Quote 1
                                        • thanksajdotcomT
                                          thanksajdotcom @tonyshowoff
                                          last edited by

                                          @tonyshowoff said:

                                          @thecreativeone91 said:

                                          On Any OS that doesn't really make any sense. Underscores are normally used instead of spaces. but, a hyphen and period in a folder is a bit of a no-no.

                                          That or on shared space what we do is just put a ! in front of the name

                                          !mp3
                                          !ogg
                                          !wave
                                          

                                          This top sorts and and sets it apart and doesn't really break anything, though you do have to escape when cding to it when not using Windows, but that's easy and auto-tabbed. I mean I get prefixing the file name, but why with a period as well? And also why post fix it with another dot and period?

                                          It's just what I did at the time and I've never changed it. Never had a reason to until now. Still, it works and as long as I know what I have to do to get into it if I have to, I'm fine.

                                          1 Reply Last reply Reply Quote 0
                                          • scottalanmillerS
                                            scottalanmiller @thanksajdotcom
                                            last edited by

                                            @thanksajdotcom said:

                                            @tonyshowoff said:

                                            Why is this directory named something so bizarre, by the way?

                                            I didn't have any Linux systems connected to it when I named all these and I don't really have a reason, it's just how I named it at the time. I think these directories were originally part of a larger folder structure so I started the name with a dash to put them at the top and also so all the format folders would be grouped together.

                                            Best practice for life in general - don't use weird, pointless, filesystem-specific "allowances" in file names. There is no benefit but it ads risk. Even for home use, don't create the practice or habit.

                                            I don't even use caps or spaces in file names!

                                            dafyreD ? 2 Replies Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post