I want to have the same folder at two different locations in my Ubuntu. If I update something in one, it should also get updated in the other location.
How can I make it happen?
I want to have the same folder at two different locations in my Ubuntu. If I update something in one, it should also get updated in the other location.
How can I make it happen?
As pointed out in the comments but not as a proper answer:
In many cases, a symbolic link is the easiest solution.
You can create them easily on the command line (using the
ln
command with-s
parameter). You can create them easily using a GUI as well: Most file browsers (nautilus, ...) let you create a symbolic link using drag and drop (like for moving a file) while holding down a modifier key (CTRL+SHIFT).Example for command line usage:
Use bind mounts.
Suppose you have an existing directory
/home/pandey/original
and want to mirror it to/home/pandey/mirror
so that everything you do in either of them is automatically done in the other one as well.This doesn't require any syncing or copying between the two directories. A bind mount is just another view to the original directory and what happens in one also happens in the other.
Create (as your user) the new directory
/home/pandey/mirror
:bind-mount the original directory to the newly created path. This requires root access:
Enjoy.
To undo this, simply
See also this question and its outstanding self-answer over on stackexchange about bind-mounts.
You can do it by setting a crontab job:
crontab -e
i
in order to activate the insert mode of your vim editor.You can enter the command you want to be done there, so you can copy all files of the folder in another folder. For example, if you want to copy all files in
/home/user/folder_name
to/home/user/public
you should insert this command in yourcrontab
file:This will copy all files in the desired interval. If you want to copy all files at 21:30 every day your edit should be:
For more information about crontab look here or use
man crontab
.