Thread: Remove file

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2009
    Posts
    7
    Rep Power
    0

    Remove file


    I have a file named *(I created it by mistake,I know its not recommended to create such filenames) and a directory named My Documents in the current directory.
    How do you remove them with a single command ??
    I was suggested that I should use (i) escaping, (ii) quoting..Whats this??
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    96
    Rep Power
    145
    rm \* will do it.

    The \ is an escape character. The shell interprets the * as a literal character instead of an expression operator.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2004
    Posts
    2,099
    Rep Power
    1771
    just an advisory...may or may not be relevant

    I don't think "rm" really deletes the file/content just the reference (link) to it...
  6. #4
  7. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,888
    Rep Power
    9646
    Originally Posted by tj_nt
    just an advisory...may or may not be relevant

    I don't think "rm" really deletes the file/content just the reference (link) to it...
    ...if there's more than one link to it. Otherwise the OS marks the sectors on the disk as being available again and, with no connection between the file name and the data, it's lost.

    So no, the data isn't actually "deleted" per se.

IMN logo majestic logo threadwatch logo seochat tools logo