TransWikia.com

append file & directory to /

Unix & Linux Asked by zoom80 on December 1, 2021

if I have directory /test and create or copy subs directories and files , eg

root@box:/test/etc/config# ls
newfile1
newfile2
newfile3
newfolderz
newfoldery

how can be automatically appended to / with same path ?

root@box:/etc/config# ls
newfile1
newfile2
newfile3
newfolderz
newfofdery
existing_files1
existing_files2
existing_filesX

also if I remove it from /test will be removed /

thank you

One Answer

You can use symlinks:

ln -s /etc /test

Which will make an link from /etc to /test, if you modify something in /test, it will be modified in /etc too.

You can use hardlinks for files:

ln file testfile

Like with symlinks, if you modify testfile, file will be modified too.

also if I remove it from /test will be removed /

be careful while removing symlinks, don't do rm -r test/* because that will delete /etc. Instead use unlink(1)

unlink /test

Answered by user387181 on December 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP