Tar cf cannot archive files with a colon in their name

verhage

I'm currently working on a task of archiving an old web application. I made back-ups of the database and the application itself, now I'm trying to back-up the filestore that contains all uploaded files.

Unfortunately, said application hasn't always correctly handled uploaded files, which has resulted in a lot of files containing the full pathname on the client that uploaded them, for example "C:\test\test.doc".

I want to create a tar archive containing all the files, but tar cf gives errors on files having a colon in their name. I tried escaping, but no luck.

An example:

-rw-r--r-- 1 root root 29696 Jan  3 09:43 C:\test\test.doc

Just tar everything:

[root@server test]# tar cf test.tar *
tar: C\:\test\test.doc: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors

Surrounded by double quotes:

[root@server test]# tar cf test.tar "C:\\test\\test.doc"
tar: C\:\test\test.doc: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors

Using the escape character:

[root@server test]# tar cf test.tar C\:\\test\\test.doc
tar: C\:\test\test.doc: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors

Is there a way to achieve this (without file rename)?

Ipor Sircer

Use . to archive the whole directory instead of *

tar cf ../test.tar .

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

List the contents of multiple .tar archive files

From Dev

How does tar read files to create an archive?

From Dev

how to rename files you put into a tar archive using linux 'tar'

From Dev

How do I create a tar or tar.gz archive entirely from objects in memory (no files) in Java

From Dev

reading files from tar.gz archive in Nim

From Dev

Tar archive preserving hardlinks

From Dev

Reading in multiple files compressed in tar.gz archive into Spark

From Dev

Overwriting files when extracting from a tar archive

From Dev

Extract specific files in a tar archive using a wildcard

From Dev

Create tar archive of a directory, except for hidden files?

From Dev

Using find and tar with files with special characters in the name

From Dev

modify file ownership for files inside tar archive

From Dev

Overwriting files when extracting from a tar archive

From Dev

How to create tar archive split into, or spanning, multiple files?

From Dev

tar command to extract archive with colon in the name

From Dev

How to prepend a directory to files placed in a tar archive?

From Dev

cannot install application from source using tar.gz archive

From Dev

How to delete (invalid) files with colon in their name under Windows?

From Dev

How can I check if a directory contains the same files of a TAR archive?

From Dev

Tar Archive All Files with Extension

From Dev

Extract files from online tar archive using only its URL

From Dev

add to TAR and split archive of 147k files in a directory

From Dev

Tar directory into archive with the same name as the directory?

From Dev

Extract tar to a directory, removing any files it contains NOT present in the archive

From Dev

Problem with find excluding files of type socket when creating tar archive

From Dev

Trying to Create a TAR Archive, But Exclude .messages Files

From Dev

Bash script to pack roughly 1GB of files into a tar archive

From Dev

Write tar archive to tape and then extract individual files

From Dev

How to exclude a folder by name recursively when making a tar archive?

Related Related

  1. 1

    List the contents of multiple .tar archive files

  2. 2

    How does tar read files to create an archive?

  3. 3

    how to rename files you put into a tar archive using linux 'tar'

  4. 4

    How do I create a tar or tar.gz archive entirely from objects in memory (no files) in Java

  5. 5

    reading files from tar.gz archive in Nim

  6. 6

    Tar archive preserving hardlinks

  7. 7

    Reading in multiple files compressed in tar.gz archive into Spark

  8. 8

    Overwriting files when extracting from a tar archive

  9. 9

    Extract specific files in a tar archive using a wildcard

  10. 10

    Create tar archive of a directory, except for hidden files?

  11. 11

    Using find and tar with files with special characters in the name

  12. 12

    modify file ownership for files inside tar archive

  13. 13

    Overwriting files when extracting from a tar archive

  14. 14

    How to create tar archive split into, or spanning, multiple files?

  15. 15

    tar command to extract archive with colon in the name

  16. 16

    How to prepend a directory to files placed in a tar archive?

  17. 17

    cannot install application from source using tar.gz archive

  18. 18

    How to delete (invalid) files with colon in their name under Windows?

  19. 19

    How can I check if a directory contains the same files of a TAR archive?

  20. 20

    Tar Archive All Files with Extension

  21. 21

    Extract files from online tar archive using only its URL

  22. 22

    add to TAR and split archive of 147k files in a directory

  23. 23

    Tar directory into archive with the same name as the directory?

  24. 24

    Extract tar to a directory, removing any files it contains NOT present in the archive

  25. 25

    Problem with find excluding files of type socket when creating tar archive

  26. 26

    Trying to Create a TAR Archive, But Exclude .messages Files

  27. 27

    Bash script to pack roughly 1GB of files into a tar archive

  28. 28

    Write tar archive to tape and then extract individual files

  29. 29

    How to exclude a folder by name recursively when making a tar archive?

HotTag

Archive