Help! Can't delete files ...

Robert Bonomi bonomi at mail.r-bonomi.com
Wed Oct 19 19:04:33 UTC 2011


> From owner-freebsd-questions at freebsd.org  Wed Oct 19 13:53:33 2011
> Date: Wed, 19 Oct 2011 20:23:36 +0200
> From: Andy Wodfer <wodfer at gmail.com>
> To: freebsd-questions <freebsd-questions at freebsd.org>
> Subject: Help! Can't delete files ...
>
> A client has uploaded several files through a CMS and these files contain
> Norwegian letters (I think). AE O and A.
>
> I need to delete about 20 files, but I can't do it through the CMS nor by
> command line on this FreeBSD 8.1 STABLE server. There's something with the
> character encoding/keyboard or server setup I think.
>
> Please advice.
>
> This is what a file looks like when I ls:
>
> 28b Kjoepesenter n?ringsg?rdeier.docx
>
> ls | more:
>
> 28b Kjoepesenter n<91>ringsg<86>rdeier.docx
>
> If I try:
>
> # rm 28b Kjoepesenter n<91>ringsg<86>rdeier.docx
> Ambiguous input redirect



A) learn to use wildcards.
B) learn to use the '-i' option to rm
C) learn to use 'echo' to 'test' filename expansions.

For your 'problem' files, put a  '?' in  anywhere there is a space or a
'strange character'.  Check what happens using echo, then use 'rm -i', so
you make sure that you delete *only* the particular file you intend to.

e.g. for the specific file you cited above try:

   echo 28b?Kjoepesenter?n?ringsg?rdeier.docx
	
*ASSUMING* that that shows;
  28b Kjoepesenter n<91>ringsg<86>rdeier.docx

then try:
   rm -i 28b?Kjoepesenter?n?ringsg?rdeier.docx
  
Assuming that  it asks yout about deleting the full file name, type a 'y'.

Repeat for each 'problem' file.




More information about the freebsd-questions mailing list