0

I'm working with an AIX server. I created a file, ucm.txt, today. Now I am done with the file and would like to remove it.

If I do ls -ltr in my current directory, I get this.

-rw-r--r-- 1 barringer myserver 11729 Jul 16 09:11 ucm.txt

If I try to do anything with the file (have not changed directories), I get this.

=> rm ucm.txt

rm: ucm.txt: A file or directory in the path name does not exist.

=> more ucm.txt

ucm.txt: A file or directory in the path name does not exist.

EightBitTony
  • 9,311
  • 1
  • 34
  • 46
  • are you referencing the right directory or executing the command from the right directory? `rm /file/location/ucm.txt` is not the same as `rm ucm.txt` – CIA Jul 16 '15 at 17:02
  • What does ls -lq show you? – EightBitTony Aug 12 '15 at 10:39
  • => ls -ltr -rw-r--r-- 1 maaduser maad 11729 Jul 16 09:11 ucm.txt – Bob Barringer Aug 13 '15 at 18:37
  • => ls -ltr `-rw-r--r-- 1 barringer myserver 11729 Jul 16 09:11 ucm.txt` => ls -lq `-rw-r--r-- 1 barringer myserver 11729 Jul 16 09:11 ucm.txt?` => cat ucm.txt `cat: cannot open ucm.txt` => more ucm.txt `ucm.txt: No such file or directory` – Bob Barringer Aug 13 '15 at 18:42

1 Answers1

1

It is most likely there are "bad characters" or empty spaces in the file name

you can try this:

ls -1 | while read file do ls -lsd "$file" done See if the "ls" can find the file. If it can, you can adjust this script to remove the file. Be careful though: this piece of script I provided is listing ALL files in the directory, if you adjust it to remove the file, make sure it will just rm the file you want.

Dumb admin
  • 127
  • 12