Not FC5 specific...
I am trying to use a (simple) command to gzip a bunch of files in a
given directory... BUT I want to keep the original files too. gzip does
not seem to have an option to keep the original file. In some cases, the
file names contain blanks and or $ characters...
I want to gzip each file individually, not combine several files into
one .gz file.
So, I thought some form of ls and xargs would do the trick and I would
be done in 5 minutes. :-)
ls -1 *[^.gz] | xargs -r -I {fn} gzip -c {fn} > {fn}.gz
(hours pass, reams of reading later...)
I added the -p option to xargs so I could see what it is actually doing
(vs what I think it should do) and see the command actually stops at the
>. The > {fn}.gz isn't part of the command created by xargs...
Try again, escaping the > ...
ls -1 *[^.gz] | xargs -rp -I {fn} gzip -c {fn} \> {fn}.gz
The command looks good... but it does not work... it seems I get the
compressed stuff displayed on my screen instead of being writtento the
file. Isn't the > the correct redirection character so stdout goes to
the specified file?
I usually end up with a file called {fn}.gz somewhere along the line.
This has got to be simple... what am I missing? :-)
Any suggestions?
Thank you :-)