1

I would like to completely link /root/.vidoes/ to the new directory /home/videos/

If a script tries to read/update/save a file to /root/.vidoes/ for example /root/.vidoes/newvideo.mp4 then it should be saved to /home/videos/newvideo.mp4 this also needs to be the case for hidden files or directories trying to be accessed from /root/.vidoes/xyz

I've tried ln -s /home/video/ /root/.video/ but that just makes a directory in /root/.video/video that links to /home/video

3
  • ln -s /home/video/ /root/.video/ - But that just makes a directory in /root/.video/video that links to /home/video Commented Jul 2, 2018 at 13:27
  • That's a good start. Please add it to your question so we can (all) see what you have tried. Commented Jul 2, 2018 at 13:28
  • If you have gnu tools then ln supports some flags to reduce this type of error. ln -T /home/videos .videos. You still have to move stuff as in @roaima's answer. It should produce an error if you don't instead of doing the wrong thing. (there is also a -t option, see manual). The -T and -t options are in Gnu ln, cp and mv. Commented Jul 2, 2018 at 14:09

1 Answer 1

1

Given your example command creates /root/.video/video instead of linking as expected, you appear to have both directories already present

  1. Move everything that is in /root/.videos to /home/videos

    mv /root/.videos/* /home/videos    # Assumes no files beginning with a dot
    
  2. Remove the /root/.videos directory

    rmdir /root/.videos                # If this fails, check no files are still hiding in here
    
  3. Link the existing directory

    cd /root
    ln -s /home/videos .videos
    
2
  • This comes back as ls: cannot access '.videos': No such file or directory on Ubuntu 17.10 Commented Jul 2, 2018 at 13:40
  • @masterq He had a typo. It's fixed now. Commented Jul 2, 2018 at 13:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.