P
P
Pro_asker2019-12-15 18:26:39
File systems
Pro_asker, 2019-12-15 18:26:39

How to combine all txt in one folder into 1 file, while cleaning the contents of all txt without deleting the files themselves?

Hello!
How to combine all txt in one folder into 1 file, while cleaning the contents (all txt) without deleting the files themselves?
Perhaps a batch file or a script will help.
Thanks:)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
egor_nullptr, 2019-12-15
@egor_nullptr

Let's say these files are in the dir directory. Then the command code (for Linux) will be:

find dir -name "*.txt" -exec sh -c 'cat \{} >> t.txt && :>\{}' \;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question