Operating System - HP-UX
1821051 Members
2766 Online
109631 Solutions
New Discussion юеВ

want to remove file created by tar

 
SOLVED
Go to solution
amipankaj
Frequent Advisor

want to remove file created by tar

hi experts,

i was compressing a directory using following command.

tar -cvf -C /aaa

the filesystem got full and i had to terminate tar command before it will complete.

a file -C is created under root file system which is occupying 56mb space. i tried to remove it using rm command but it does not work as file name is -C.

please suggest, what will be solution for this issue, now root is 100% utilized.


thanks,
Roy
9 REPLIES 9
melvyn burnard
Honored Contributor

Re: want to remove file created by tar

try:
rm \-C
or
rm -i *C and just say yes to the relevant file

My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Shrikant Lavhate
Esteemed Contributor

Re: want to remove file created by tar

Hi,

What error you are getting?

If file does not exist then you can check with any non-printable character in filename explained here : http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1250600

If file is in use kinda error then make sure you have killed tar process completly.
Will it remain a personal, if I broadcast it here!
amipankaj
Frequent Advisor

Re: want to remove file created by tar

its giving following error.

# rm -i *C
rm: illegal option -- C
Usage: rm [-Rfir] file ...
# rm \-C
rm: illegal option -- C
Usage: rm [-Rfir] file ...
#


here is the file...

-rw-r--r-- 1 root sys 54059008 Jul 18 04:13 -C

# pwd
/
Robert-Jan Goossens_1
Honored Contributor
Solution

Re: want to remove file created by tar

Hi Roy,


You can use the -- option with rm remove the file.
# rm -- -C

Regards,
Robert-Jan
Shrikant Lavhate
Esteemed Contributor

Re: want to remove file created by tar

$pwd
/
$ cd "-C"
$ cd ..
$ rmdir -i "$OLDPWD"

Will this make any sence?
Will it remain a personal, if I broadcast it here!
melvyn burnard
Honored Contributor

Re: want to remove file created by tar

hmm, just did some playing, created a file -C, and checked this method:
rm -- -C
This removed the file, so try that
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
amipankaj
Frequent Advisor

Re: want to remove file created by tar

Thanks guys....


it works fine..
Dennis Handly
Acclaimed Contributor

Re: want to remove file created by tar

>Robert-Jan: You can use the -- option with rm remove the file.

Yes, this "--" is Posix standard. You can also use: rm ./-C

>Shrikant: What error you are getting?

Files starting with a "-" are a different kettle of fish.
amipankaj
Frequent Advisor

Re: want to remove file created by tar

thanks...