Solved

Untarred files have extra charcters

Posted on 2004-10-08
3
204 Views
Last Modified: 2013-12-16
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
Comment
Question by:lesfazekas
  • 2
3 Comments
 
LVL 10

Expert Comment

by:Luxana
ID: 12258819
>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
 
LVL 10

Assisted Solution

by:Luxana
Luxana earned 125 total points
ID: 12258877
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
 
LVL 6

Accepted Solution

by:
blkline earned 125 total points
ID: 12366851
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question