Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Angry Can not delete file that starts with dashes

    I had a big problem! I'm a confident user of linux but today I've probably encountered a bug of the system.There are 2 files in the folder (not advertising these sites, I downloaded the music):
    I tried to move the file:
    mv '-flejta_ ( (1) .mp3' flejta.mp3
    mv: invalid key - "l"
    With the command "mv --help" you can get more information.
    I tried to delete the file:
    rm '-flejta_ ( (1) .mp3'
    rm: invalid key - "l"
    Try "rm ./'-flejta_( )(1).mp3 '" to delete the file' -flejta_ ( (1) .mp3 '.
    With the "rm --help" command, you can get more information.
    I used programming:
    select i in *; do mv "$i" flejta.mp3 ;done
    And it gave the same mistakes.
    I do not use graphic managers, so do not offer me any.

  2. #2
    This, too, does not pass by the way
    rm ./'-flejta_( (1) .mp3 '
    rm: can not be deleted './-flejta_( (1) .mp3': There is no such file or directory

  3. #3
    Linux User
    Join Date
    Dec 2017
    OK, I'm using Android I did this:

    $ touch ./"-test"
    $ ls
    -test Alarms ...
    $ rm -rf ./"-test"
    $ ls
    Alarms ...

    So, I don't know what's happening on your end, but erasing files with dashes in the beggining can be done...

    Sent from my Moto G Play using Tapatalk

  4. $spacer_open
  5. #4
    Linux Guru
    Join Date
    Dec 2013
    VeryUserLinux, you need to learn to read. it's telling you what to try:
    Quote Originally Posted by VeryUserLinux View Post
    Try "rm ./'-flejta_( )(1).mp3 '" to delete the file' -flejta_ ( (1) .mp3 '.

Posting Permissions

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