Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一个将特定文件夹中的树结构(包括文件夹中的所有数据)写入文本/dat 文件的 shell 脚本。
到目前为止,我得到了这个:
find . -type f|sed 's_\.\/__' > PATH/Input.dat
我不想将“/”作为路径的第一个字符。
此脚本工作正常,但它返回所有文件夹结构。我需要只返回特定文件夹中的结构的东西,比如“销售”。
我需要只返回特定文件夹中的结构的东西,比如“销售”。
指定所需的文件夹名称。说:
find Sales -type f | sed 's_\.\/__' ^^^^^
说find . ...会搜索.(即当前目录和子目录)。
find . ...
.
如果您需要搜索更多文件夹,例如Purchase,请指定这些文件夹:
Purchase
find Sales Purchase -type f | sed 's_\.\/__'