Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, I have this file in my working directory i am having problems deleting. When i use the rm command, i am getting the following: "rm: cannot remove `cold_re_inj_com.dat.gz': Invalid ...
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Posts
    6

    problem deleting file using rm

    Hi,

    I have this file in my working directory i am having problems deleting. When i use the rm command, i am getting the following:

    "rm: cannot remove `cold_re_inj_com.dat.gz': Invalid argument"

    Is there anything else i can do to remedy this problem. This file is taking all my disk space and i need it deleted as quickly as possible.

    Thanks in advance for the assistance.

    James

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Exclamation

    Hi James ,
    I can't figureout what the problem could be....
    Try this simple c program,
    -----------------------
    #include<sys/stat.h>
    /* Below enter Filename to be Removed with complete path name like "/root/home/cold_re_inj_com.dat.gz"*/
    #define XYZ "/root/home/cold_re_inj_com.dat.gz"
    main(){
    int i;
    i=unlink(XYZ);
    if(i==0)
    printf("\nFile Removed");
    else
    printf("\nFile not Deleted...");
    }
    ----------------------
    I guess i should work
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  3. #3
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    Was that first single quote a proper single quote ( ' ) or a backquote ( ` )? If it was a backquote, that would explain your error message. You need two single quotes or two double quotes to literalise a string such as a filename. Backquotes mean something different: they are used to enclose a command that is to be replaced by its output.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  4. #4
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    That backquote is a part of the rm output: it doesn't have anything to do with the command he entered.

    Are you sure that you're in the same directory as the file? Try using the full path of the file, for instance:
    Code:
    rm /home/user/the_file
    DISTRO=Arch
    Registered Linux User #388732

  5. #5
    Just Joined!
    Join Date
    Nov 2006
    Posts
    6
    Hi,

    Thanks for responding. I am in the same directory as the file and the rm command is not just working. I even tried using the -f to force the file to be removed but that too failed. When i entered the full as you suggested, i got the following message:

    rm: cannot remove `/home/jw656314/willie/cold_re_inj_com.dat.gz': Invalid argument

    This thing sucks. The file is taking up almost all my directory space and yet i cannot delete the file.

    Thanks again.

    James

  6. #6
    Just Joined!
    Join Date
    Nov 2006
    Posts
    6
    Hi Again,

    This is the thing i get when i type the "ls -lrt" command:

    ?---------?---------+ ? ? ? ? ? cold_re_inj_com.dat.gz

    No way to figure out the kind of file or the file size

    Maybe this will throw more light on my problem.

    James

Posting Permissions

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