linux - Processing files with spaces in their name -


i have many big csv files under many folders , file , folder have spaces in names.

i have code below doesn't work when file/folder has spaces in name:

csv=$(find . -name "*.csv")  f in $csv;   echo "compressing $f"   (cd $(dirname $f) && zip -j $(basename $f.zip) $(basename $f)) done 

have find execute zip itself, since still knows spaces:

find -name '*.csv' -exec zip -j {}.zip {} \; 

a direct port of wrote use -execdir in place of -exec, appears not necessary.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -