So I have .lzo files in /test01/primary folder which I need to uncompress and then delete all the .lzo files. Same thing I need to do in /test02/secondary folder as well. I will have around 150.lzo files in both folders so total around 300 files.From a command line I was running like this to uncomressed one file lzop -d file_name.lzoWhat is the fastest way to uncompressed all .lzo files and then delete all .lzo files from both folders. I came up with below code. #!/bin/bashset -eexport PRIMARY=/test01/primaryexport SECONDARY=/test02/secondarylzop -d $PRIMARY/* & lzop -d $SECONDARY/*find $PRIMARY $SECONDARY -name '*.lzo' -deleteMay be we can decompress the .lzo files in parallel and then delete all .lzo file in both the folders simultaneously to speed up the process.Is there a better way?
Uncompressed .lzo files in parallel and then delete the original .lzo files
shell;archive;parallelism
Per the man page:   -U, --unlink, --delete              Delete input files after succesful compression or decompression.so you could simply runlzop -dU -- {$PRIMARY,$SECONDARY}/*.lzoto delete each lzo file as soon as it's successfully decompressed.lzop is single-threaded so if you want parallel processing you could use gnu parallel:parallel lzop -dU -- ::: {$PRIMARY,$SECONDARY}/*.lzo