Copy files with spaces on its filenames in Linux? Use xargs parameter to copy files that have spaces on its filenames. In Linux to copy a file which has a space on the filename must be enclosed in a parenthesis. But if copying multiple files with has a space on their filenames is another story. It is still an easy task to do with the use of xargs parameter. Below is an example on how to use xargs to copy files with spaces on their filenames. Command tested on a Red Hat Linux operating system and works okay. Here's the command: find . -iname "*.txt" -print0 | xargs -0 -I {} cp {} /home/backup/txt_2015 Do not omit -0 and -I parameters or else system will have this error: Above command will search for files with ".txt" extension and copy to /home/backup/txt_2015 folder. Replace the cp with mv if need to move files instead of copying. xargs: Warning: a NUL character occurred in the input. It cannot be passed through in the argument l...
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.