1753797 Members
7388 Online
108799 Solutions
New Discussion юеВ

Re: mv question

 
SOLVED
Go to solution
chapaya_1
Frequent Advisor

mv question

Hi ,

I have this directory /appl/appl ,
I want to move the whole directory to /appl .

What is the best way ?

BYE
14 REPLIES 14
Michael Tully
Honored Contributor
Solution

Re: mv question

cd /appl/appl
mv * ..

rm -f appl1
Anyone for a Mutiny ?
Mark Grant
Honored Contributor

Re: mv question


mv /appl/* /appl
rmdir /appl/appl
Never preceed any demonstration with anything more predictive than "watch this"
Franky_1
Respected Contributor

Re: mv question

Hi,

just type

cd /appl/appl
tar cfv - .|(cd ../; tar xfv -)
cd ..
rm -r appl

That's it

Franky
Don't worry be happy
Frederic Sevestre
Honored Contributor

Re: mv question

Hi,

You can try

cd /appl
tar cf - appl | (cd / ; tar xvf -)
rmdir /appl/appl

Regards,
Frederic
Crime doesn't pay...does that mean that my job is a crime ?
YoungHwan, Ko
Valued Contributor

Re: mv question

# cd /appl/appl

# find . -dept -print | cpio -pudmv /appl

# cd /appl

# rm -r /appl/appl

MarkSyder
Honored Contributor

Re: mv question

Could I just add to Michael and Mark's excellent answers that you may have files that start with . (dot) so you should also do:

cd /appl/appl
mv .* ..

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
chapaya_1
Frequent Advisor

Re: mv question


I got this :

hp1:>pwd
/appl/appl
hp1:>mv * ..
hp1:>ls
.cshrc .exrc .login .profile
hp1:>mv .* ..
mv: ../.: rename: Device busy
mv: .. and .. are identical
hp1:>ll
total 0

The files moved but i got this error ...
Francisco J. Soler
Honored Contributor

Re: mv question

Hi,

another way to do it:

cd /
mv /appl/appl /temp_dir
rm -rf /appl
mv /temp_dir /appl

Frank.
Linux?. Yes, of course.
V. Nyga
Honored Contributor

Re: mv question

Hi,

this happened, because you also tried to moved '.' and '..' in the upper directory.(where this files already exists.)
You can ignore this error message.
But maybe '..' isn't there any more?
Check it with 'll -a'

Then type 'cd /apps' to move one step up.

Volkmar
*** Say 'Thanks' with Kudos ***