Operating System - HP-UX
1833876 Members
1850 Online
110063 Solutions
New Discussion

Re: Weird directory entry

 
SOLVED
Go to solution
Robin King_1
Regular Advisor

Weird directory entry

Can anyone help explain this entry in a directory on one of my servers:

-rwxrwxr-x 1 cyborg cyborg 7 Oct 11 2002 file04.NANAC2
-rwxrwxr-x 1 cyborg cyborg 14 Jul 25 2001 file04.NANAC2
RDRDG2
-rwxrwxr-x 1 cyborg cyborg 7 Jul 25 2001 file04.NANAT1

It's the RDRDG2 I'm worried about. It was brought to my attention by a job I run every night to do a scp of these files.
This is the error message I'm getting:

"RDRDG2: skipping, filename contains a newline"

basil:/cyb45/test/params>file RDRDG2
RDRDG2: cannot open
9 REPLIES 9
Jakes Louw
Trusted Contributor

Re: Weird directory entry

The filename is actually:

"file04.NANAC2 RDRDG2"

You're seeing an effect of a line-wrap on your display.
Trying is the first step to failure - Homer Simpson
melvyn burnard
Honored Contributor
Solution

Re: Weird directory entry

looks like you may have had a file created wit a cr character embedded in hte name.
If you do :
ls file04.NANANC2*
what do you get?
and
ls file04.NANANC2*2

If the second command returns the file
file04.NANAC2
RDRDG2

then try doing
mv file04.NANANC2*2 file04.NANANC2_RDRDG2


My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Robin King_1
Regular Advisor

Re: Weird directory entry

I don't think it is Jakes. An "ls" returns:

file04.NANAC1
file04.NANAC2
file04.NANAC2
RDRDG2
file04.NANAT1
file04.NANAT2
file04.NCNCC1
Mark Grant
Honored Contributor

Re: Weird directory entry

One of your filenames has a newline character in it.

If the output you have given above is the exact output from a "ls -l" I would guess the culprit is the file "file04.NANAC2".

If the filename is really "file04.NANAC2RDRDG2" you probably want to remove it because you already have a file called file04.NANAC2 which is quite recent.

You could remove your odd file by going

rm -i file04.NANAC2* and entering "y" when it shows you the one with the funny name.
Never preceed any demonstration with anything more predictive than "watch this"
Pete Randall
Outstanding Contributor

Re: Weird directory entry

Robin,

Could that actually be file04.NANAC2RDRDG2?

Check with ll file04.NANAC2*


Pete

Pete
RAC_1
Honored Contributor

Re: Weird directory entry

There is special character in that file name.

check that with ll -b or ll|cat -v
Then do a ll -il and find the inode no of it and then rename the file.

the find syntax is as follows.
cd /dir where file resides.

find . -inum "inode_no"|while read a;do mv $a file.txt;done

Anil
There is no substitute to HARDWORK
Alan Turner
Regular Advisor

Re: Weird directory entry

I suspect your file is actually "file04.NANAC2\nRDRDG2", where "\n" represents the newline character. Ther emay be other non-printing characters in there too.
Try "ls -lb" - the "-b" option shows non-printing characters in octal (\n corresponds to \012).

If this is the case, it should be possible to delete it, although you may have to use something other than rm, e.g.

perl -e 'unlink "file04.NANAC2\nRDRG2"'

Anyway - please post ls -lb output.

regards

Alan

Robin King_1
Regular Advisor

Re: Weird directory entry

Spot on Melvyn, thanks
Jakes Louw
Trusted Contributor

Re: Weird directory entry

You can delete as well by using find :

find -inum xxxx -exec rm {} \;
Trying is the first step to failure - Homer Simpson