我有一个巨大的目录结构的电影文件。为了分析该结构,我想复制整个目录结构,即文件夹和文件,但是我不想复制所有的电影文件,而我想保留文件名。理想情况下,我得到原始电影文件名的零字节文件。
我试过,然后rsync远程机器没有获取链接文件。
解决方案任何想法如何做到这一点,您可以使用find:
找到src / -type d -exec mkdir -p dest / {} \; \ -o -type f -exec touch dest / {} \;查找目录( -d src / )并在 dest / $ c下创建( mkdir -p $ c>或( -o )查找文件( -f )和 code> dest / 。
这将导致:
dest / src /< file-structre>您可以使用 mv
$ b其他(部分)解决方案可以使用rsync实现:
rsync -a --filter = - !* /sorce_dir / target_dir /这里的窍门是 - filter = RULE 选项,排除( - )所有不是!的目录( * / )
I have a huge directory structure of movie files. For analysis of that structure I want to copy the entire directory structure, i.e. folders and files however I don't want to copy all the movie files while I want to keep there file names. Ideally I get zero-byte files with the original movie file name.
I tried to and then rsync to my remote machine which didn't fetch the link files.
Any ideas how to do that w/o writing scripts?
解决方案You can use find:
find src/ -type d -exec mkdir -p dest/{} \; \ -o -type f -exec touch dest/{} \;Find directory (-d) under (src/) and create (mkdir -p) them under dest/ or (-o) find files (-f) and touch them under dest/.
This will result in:
dest/src/<file-structre>You can user mv creativly to resolve this issue.
Other (partial) solution can be achieved with rsync:
rsync -a --filter="-! */" sorce_dir/ target_dir/The trick here is the --filter=RULE option that excludes (-) everything that is not (!) a directory (*/)
更多推荐
复制具有无内容的文件名的目录结构
发布评论