Alright, so simple problem here. I'm working on a simple back up code. It works fine except if the files have spaces in them. This is how I'm finding files and adding them to a tar archive:
find . -type f | xargs tar -czvf backup.tar.gz
The problem is when the file has a space in the name because tar thinks that it's a folder. Basically is there a way I can add quotes around the results from find? Or a different way to fix this?
Use this:
It will:
tar -c
withxargs
will do when you have a large number of filesAlso see:
There could be another way to achieve what you want. Basically,
Then tar with the -T option which allows it to take a list of file locations (the one you just created with find!)