Find the answer to your Linux question:
Results 1 to 9 of 9
I wish I knew how this one happened, but fixing it is giving me nightmares. At work, we run Spamassassin as a daemon under Exim. So far, so good. But ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2004
    Location
    Montrose, CO USA
    Posts
    7

    Removing a file that has an illegal filename


    I wish I knew how this one happened, but fixing it is giving me nightmares.

    At work, we run Spamassassin as a daemon under Exim. So far, so good. But recently, we got two spam emails in that look like this:

    Code:
    1084295179_"COPS04-040511170744Z-33702*-PRMD=C.O.P.S.-ADMD= -C=US-"@MHS
    
    1084302537_"COPS04-040511191019Z-34501*-PRMD=C.O.P.S.-ADMD= -C=US-"@MHS
    (The number string before the first underscore is something Exim adds.)

    The issue is the " -C=US-" thing, which is a space followed by a -C. Every basic program on Linux, from cp to mv to rm is treating this as a command flag when it is not. This has totally screwed up my admin scripts.

    Is there any way I can remove this file from the command line?

  2. #2
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    You should be able to replace the space with '\ ' (minus the ', that's a slash space), and then replace '-' with '\-' (minus the ').

    FYI, dashes are not illegal characters for file names. They just make it a pain in the [insert favorite curse here].

    Hope that helps!
    Jeremy
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  3. #3
    Just Joined!
    Join Date
    Apr 2004
    Location
    Montrose, CO USA
    Posts
    7
    Thank you! I'll give that a shot.

    It's always something simple, you know?

  4. #4
    Linux User
    Join Date
    Jan 2004
    Posts
    357
    You can also use quotes around the name. I actually belive that single or double quotes will work, but your distro might wan't one over the other. Single works well under Redhat / Fedora.

    something like

    Code:
     mv 'file name.txt' /home/me
    That would move a file called file name.txt to the directory /home/me

  5. #5
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    Code:
    It's always something simple, you know?
    The solution is only simple if it works!

    That's why were here. Good luck!
    Jeremy
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  6. #6
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    Quote Originally Posted by jeremy1701
    Code:
    It's always something simple, you know?
    The solution is only simple if it works!

    That's why were here. Good luck!
    Jeremy
    And you always look back on it and say, "Now why didn't I think of that in the first place?"
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  7. #7
    Just Joined!
    Join Date
    Apr 2004
    Location
    Montrose, CO USA
    Posts
    7
    Trust me, I know how that is.

    Unfortunately, neither escape characters or quotes worked. (I think I know why, though.) However, logging into the GUI directly on the box itself allowed me to just use Nautilus to get rid of the offending files.

    Either way, my problem is solved. Thank you all very much for the help!

  8. #8
    Linux Newbie
    Join Date
    Feb 2004
    Location
    India
    Posts
    132
    You could have used mc
    Midnight Commander
    You are the one Linux!

  9. #9
    Just Joined!
    Join Date
    Apr 2004
    Location
    Montrose, CO USA
    Posts
    7
    D'oh! Why didn't I think of that? Maybe I should install it...

Posting Permissions

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