How do I move a directory and subdirectory to overwrite another directory in unix

Posted on 2009-02-24
Last Modified: 2013-12-27
How do I move a directory and subdirectory to overwrite another directory in unix....
I'm unable to use the move command. Here's an example of what I'm trying to do.
mv HPOvLIC /var/opt/OV
This doesn't replace the directory under /var/opt/OV

what command can use to do this
Question by:anthony
    LVL 40

    Expert Comment

    What do you mean by overwrite ? why don't you remove that subdir and then move?
    LVL 22

    Accepted Solution

    I am a little confused about where you are executing the command and where the HPOvLIC directory is. The pwd command
    has printed two directories. Am I correct in assuming that you have a directory /opt/OV/HPOvLIC and you want to move
    it to /var/opt, renaming it to /var/opt/OV and replacing the current /var/opt/OV?

    If so, then you need to do this:

    mv /var/opt//OV /var/opt/OV.old
    mv HPOvLIC /var/opt/OV
    rm -rf /var/opt/OV.old


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
    Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now