This Bash script is designed to concatenate the contents of all files within a specified directory while excluding itself and the output file from the concatenation. The resulting concatenated content is saved to the "concatenated.txt" file, separating each file's content with a header that includes the file's path.
-
Download this script and place it in the directory containing the files you want to concatenate.
-
Make the script executable, if necessary:
chmod +x workspace_concatenator.sh
-
Execute the script:
./workspace_concatenator.sh
-
After running the script, the concatenated content will be saved in a file named "concatenated.txt" in the same directory.
You can customize the behavior of the script by modifying the following variables in the script:
-
path
: The directory from which files will be concatenated. By default, it is set to the current directory. -
output
: The name of the output file where the concatenated content will be saved. By default, it is set to "concatenated.txt". -
script_name
: The name of the script itself. It is used to exclude the script from concatenation.