Given:
Folder structure as (file.txt
are plain text files in each directory, not symlinks):
/basedir/A/file.txt
/basedir/B/file.txt
/basedir/C/file.txt
The same file.txt
that sits in /mydir
:
/mydir/file.txt
I need a command that would run from /basedir
that:
/file.txt
(in .A/
, ./B
and ./C
)file.txt
files/mydir/file.txt
Can that be done in a single bash command?
Thank you!
This will do it:
find /basedir -type f -name file.txt -exec ln -sf /mydir/file.txt '{}' \;
This finds all files named file.txt
under /basedir
, and runs ln
on each to replace it (-f
) with a symbolic link (-s
) to /mydir/file.txt
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments