I need to recursively zip the individual files itself in the directory path and its sub folders without zipping the folders or directory. I also need to exclude certain file types (more then one).
How can I do this in Linux using ZIP?
Here is the modified script (thanks Ravexina).
#!/bin/bash
echo "hello world"
dir=/home/fjaffer/temp
#cd "${dir}"
#cd $(echo $dir | tr -d '\r')
cd "$dir"
find -not -iname '*.txt' -type f | while read -r file_name; \
do zip "$(dir "$file_name")".zip "$file_name" ; done
Output: line 8 zip command not found.
zip
installed, install it using:sudo apt install zip