System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

HPUX - basic cp command 11iv2

Tom Haddad
Super Advisor

HPUX - basic cp command 11iv2

Ok..this is basic HPUX administration 101...

I performed an LL on a directory and noticed s subir and file...both with same name
I want to copy the file to another location..

How does the cp determine (or even the mv command) which to perform the operation on?

yea...I had to asked the question!!!
4 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: HPUX - basic cp command 11iv2

Hi Tim:

You have non-printing characters in either the file name or the directory name. You can expose them with:

# ls -lb

If you then use the inode number from:

# ls -il

...you can rename ('mv') :

# cd /path && find . -xdev -type f -inum -exec mv {} mynewfile \;

Regards!

...JRF...
Mike Miller_8
Regular Advisor

Re: HPUX - basic cp command 11iv2

Issue the "ll -il" command and locate the inum value. Issue the "find . -inum #### -exec rm {} \;" command to remove the file.
TwoProc
Honored Contributor

Re: HPUX - basic cp command 11iv2

yeah, it's junk in your file name.

you can do a:

ls | od -c

to see the two file names are different.

I use "mv -i" to fix stuff like this.

Just use 'mv -i samefile newfile' command.
Answer yes to the first, no to the second.

Now, you've got two different file names, which helps a lot.

Now do

ls | od -c

to see if you've fixed the problem already, or if samefile still has junk in it. Keep in mind that you had a 50/50 chance of fixing the issue in the previous command.

If it does, run "mv -i ./*samefile* anotherfilename"
and answer yes to your command.

At this point, you should have two different names, both clean. One a directory, one a file, fix them both like you'd like have them finally be represented.

John
We are the people our parents warned us about --Jimmy Buffett
Tom Haddad
Super Advisor

Re: HPUX - basic cp command 11iv2

ll on the inode worked fine.thanks!!