Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 918
  • Last Modified:

AIX 5 How to delete a folder "abc^M"

Hi all EXPERTS

Recently, I used a self custom script to extract a list of file into a folder.  Unluckily, the script is encoded in wrong because of the ascii / binary problem.  All the line ended with ^M and therefore extract it into a new folder.  e.g  "extract -xvf xxx.sar -R /abc^M"

By using ls -l, there are two folders with the same name:-
drwxr-xr-x     8     suppt    system   4096   Sep 15    23:50 abc
drwxr-xr-x     6     root       system  3584   Sep 15     23:51 abc
drwxr-xr-x     8     suppt    system   4096   Sep 15    23:50 abc.bak
drwxr-xr-x    11    suppt    system   2048   Jun 17      10:45  global

By using ls -l, like this
abc         abc.bak
              global

I wanna to delete the second line folder
"root       system  3584   Sep 15     23:51 abc"  
Any solutions?

Please advice.  Thanks in advance.
0
towo2002
Asked:
towo2002
  • 2
  • 2
1 Solution
 
omarfaridCommented:
Hi,

What is the last char is it cntl-M or hatM (hat == ^)?

Any way, if you are referring to a hidden char, then try:

rm -ri abc?

the "?" refer to single char in the dir name. The -i is to make it interactive (to confirm before it deletes the file).

0
 
towo2002Author Commented:
Thanks omarfarid

It works.  Great!!!

How about if there are 2 hidden char, I've to use 2 "??" then?

Please advice, thanks.
0
 
omarfaridCommented:
Yes, ?? will do
0
 
towo2002Author Commented:
Great, thanks!!!
0
 
TintinCommented:
Also useful to know is the -b option to ls.

If you do

ls -lb

it will display any unprintable characters in filenames.  This is particularly useful if a filename contains a bunch of control characters.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now