LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Broken File Names (https://www.linuxquestions.org/questions/linux-newbie-8/broken-file-names-4175474022/)

NotAComputerGuy 08-20-2013 11:18 AM

Broken File Names
 
I've got a few file names that are broken.
Code:

ls
Shows this:
Code:

- - 200mph - Street - Race - ♛ - ✔ ~~★~SPECTACULR~TT~★~~ ✔  Isle_of_Man_TT-.mp4
But if I do the following or try do anything with that file I get this
Code:

ls *mp4
or
Code:

ls "- - 200mph - Street - Race - ♛ - ✔ ~~★~SPECTACULR~TT~★~~ ✔  Isle_of_Man_TT-.mp4"
I get this:
Code:

ls: invalid option -- ' '
Try `ls --help' for more information.

I'm grateful for any suggestions

ntubski 08-20-2013 11:23 AM

Use -- to separate options from file names:
Code:

ls -- *mp4
# or
ls -- "- - 200mph - Street - Race - ♛ - ✔ ~~★~SPECTACULR~TT~★~~ ✔  Isle_of_Man_TT-.mp4"


NotAComputerGuy 08-20-2013 11:32 AM

Quote:

Originally Posted by ntubski (Post 5012573)
Use -- to separate options from file names:
Code:

ls -- *mp4
# or
ls -- "- - 200mph - Street - Race - ♛ - ✔ ~~★~SPECTACULR~TT~★~~ ✔  Isle_of_Man_TT-.mp4"


Thank you, it works. I didn't have any though options. I'm confused as to *why* it works?

ntubski 08-20-2013 12:21 PM

Quote:

Originally Posted by NotAComputerGuy (Post 5012576)
I didn't have any though options. I'm confused as to *why* it works?

Your file started with a "-", anything starting with a "-" is an option. Another method is to name the file without a leading "-":

Code:

ls "./- - 200mph - Street - Race - ♛ - ✔ ~~★~SPECTACULR~TT~★~~ ✔  Isle_of_Man_TT-.mp4"


All times are GMT -5. The time now is 10:45 PM.