Say there is a directory foo
where there are files:
$ ls
001.mp4
002.mp4
While being in another directory bar
I'd like to have the same files as in bar
but empty. What have I tried so far:
When in bar
I execute:
$ find ../foo -type f |xargs -0
I get:
../foo/001.mp4
../foo/002.mp4
This gives me a list of files but with relative path while I need only filenames (with extensions).
Maybe more simple way exists, but here how I'm getting the result you expect:
You can try this:
This will do the job:
While in
bar
run the following command changing/PATH_TO/foo/
with the real path tofoo
:Notice:
In some cases parsing the output of
ls
might be better avoided.