Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

Untarred files have extra charcters

Hello

I am tarring a web site html directory and moving it to another server.

The site has several files that take on the form My File 6.jpg, My File 8.jpg etc
When I tar these and then untar them they become My\ File\ 6.jpg and My\ File\ 8.jpg

I realize that this is probably due to the spaces in the filename.

Is there any way to preserve the filename exactly with the spaces when I create the tar file.

Thanks
Les
0
lesfazekas
Asked:
lesfazekas
  • 2
2 Solutions
 
LuxanaCommented:
>Is there any way to preserve the filename exactly with the spaces when I create the tar file.

there is way use escape character "\" which tar did for you.

is good habbit to create files with no space or My_File6.jpg



0
 
LuxanaCommented:
To create files with space you for example My_File6.jpg:

touch My\ File6.jpg
or
touch "My File6.jpg"

So if you si files like My\ File\ 6.jpg and My\ File\ 8.jpg this files are with space just shell escape " " space with \ so they are still  My File 6.jpg and so on..
0
 
blklineCommented:
There shouldn't be a problem here.

The tar utility is showing the back-slashes in its verbose output (say if you do this: tar -xvzf  myfilename.tgz) but the file itself is stored without the back slashes.  So the effect is harmless.

0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now