unix quest

i have few files which i cant delete?
can someone help
they begin with x and then a hash sign?

aix 4.5

[FONT=r_ansi]
i cant even cut an paste to this forum, the files dont appear?
[/FONT]
 
Try a quick shell script, or type it into the command shell - BUT BE CAREFUL:

for i in `ls`
do
echo -n OK to Delete $i
read y
if [ "$y" = "y" ] -o [ "$y" = "Y" ]
then
rm $i
fi
done
 
If you want something a bit briefer, try these:

"rm ./-filename"

or

"rm - -filename"

or worst-case

"rm -i *" and answer "Y" to the filename
 
i had to go with the script option for 2 reasons
1. "ls" was the only command that listed the file concerned
2. i am not comfortable using rm in the root directory of our production system. i remember once i used rm -i * and it ignored the -i , due to some strange reason, maybe an incorrect alias setup.

anyhow script worked like a dream, thanks for your help.
 
No probs, glad to be able to help.

I have found that the script will delete files with unusual characters in the filename where rm on its own just doesn't work.

For some reason, our system had some files that had very long binary-style filenames that had been left by a previous programmer. This meant that any attempt to ls files in the directory resulted in the screen being locked and a stty intr "" ^J command had to be used to get out of it. The filenames contained invisible control characters and I couldn't copy and paste them to delete the files, but the script dealt with them.

You have to be very careful when deleting files in Unix, especially under / , but also in other places. The only safe place to delete files willy-nilly is in user-created directories.
 
Back
Top