I am trying to make an archive using tar. The paths to the files I want to put into the archive are located on a file (named fis). However, some paths have folders with spaces in them and I cannot modify that.
When I try to create the archive using:
Code:
tar -cvjf archive.tar.bz2 `cat fis`
it tells me that some files cannot be found like this:
Code:
tar: ./United: Cannot stat: No such file or directory
tar: Kingdom/noz: Cannot stat: No such file or directory
where the file to be archived is ./United Kingdom/noz
When I change the text from fis to ./United\ Kingdom thus escaping the space, the program outputs (at the same instruction:
Code:
tar: ./United\\: Cannot stat: No such file or directory
tar: Kingdom/noz: Cannot stat: No such file or directory
I noticed that it uses another \ to escape its ":", so it is familiar with escaping. I tried quoting in single and double quotes the folder name and it still does not work.
The rest of the folders (without spaces in them) are archived perfectly well. Also, inserting the address from the keyboard works as well.
Can you please tell me how to create that archive using the list of addresses from fis? Adding (or appending) them manually is clearly not an option. If you can suggest another method of redirecting please quote the corresponding command. You have the names there. And the working directory contains the file "fis" that contains the addresses.