tar

Unix command to create a tar of a specified number of files

I am looking for a Unix command which will create a tar of 10 files from a directory. ...

How to determine if data is valid tar file

My upload form expects a tar file and I want to check whether the uploaded data is valid. The tarfile module supports is_tarfile(), but expects a filename - I don't want to waste resources writing the file to disk just to check if it is valid. So, is there a way to check the data is a valid tar file without writing to disk, using stand...

"Untar" file on iPhone

Hi All, I'm writing an iPhone app which downloads a tar-gzipped file from a Webserver, then needs to unarchive this file so that it can be copied into the app's Documents folder. I'm using tar/gzip because I want to download a whole bunch of small files in one HTTP request, to make everything nice and fast. I've investigated solutions...

Is There an Archiving Library Without Dependencies? (C/C++)

Hey, I'm looking for an archiving library that functions like GNU's tar, but without any dependencies. I need some sort of archiving format to manage resources in my game engine and am still iffy about rolling my own. ...

ANT, tar task: create symbolic links in the output .tar.gz file?

We are using Windows as development system and ANT to create the platform-specific bundles. For the Mac OS X specific bundle (.tar.gz file) we are using the tar task. I want to create a symbolic link in the output .tar.gz file which points to another file in the same .tar.gz file. Can this be done using ANT? ...

How to check if a Unix .tar.gz file is a valid file without uncompressing?

I also found this link. But I was wondering if there is any ready made command line solution? ...

reading tar file contents without untarring it, in python script.

Hi All, I have a tar file which has number of files within it. I need to write a python script which will read the contents of the files and gives the count o total characters, including total number of letters, spaces, newline characters, everything, without untarring the tar file. ...

how do i get the byte count of a variable in python just like wc -c gives in unix

hi all , i am facing some problem with files with huge data. i need to skip doing some execution on those files. i get the data of the file into a variable. now i need to get the byte of the variable and if it is greater than 102400 , then print a message. update : i cannot open the files , since it is present in a tar file. ...

[PHP] Problems after Untarring a Tar Ball

Hi, I am creating a back up system for a content management system. This backup grabs a copy of the database and all of the files in a 'userfiles' folder, tars it up and allows the client to download it. This works fine. I am having issues with importing the file. The files in tarball keep their location. On my Mac I am using XAMPP fo...

Tar problem with apache commons compress

Hello, I'm having a hard time trying to tar some files using the compress library. My code is the following, and is taken from the commons.compress wiki exemples : private static File createTarFile(String[] filePaths, String saveAs) throws Exception{ File tarFile = new File(saveAs); OutputStream out = new FileOutputStream...

What exactly is the GNU tar ././@LongLink "trick"?

I read that a tar entry type of 'L' (76) is used by gnu tar and gnu-compliant tar utilities to indicate that the next entry in the archive has a "long" name. In this case the header block with the entry type of 'L' usually encodes the name ././@LongLink . My question is: where is the format of the next block described? The format o...

tar format alternative

I need to archive multiple files using ruby, but I need to archive them in such way that they could be extracted without using my script (so I need popular format). Problems with tar are max file length and problems with random file access while writing tar. Good pure ruby library or ruby binding is highly desirable. Built-in compress...

Archiving (tar and compress) with metadata (user id, and ctime) in Python

I am in the process of backing up a filesystem and I need to make sure that the metadata is conserved (the file owner and creation time). The tarfile module in Python is really helpful, and I use it extensively in my solution. However, I cannot create the tar file with files conserving their metadata (presumably because copy and copy2 ...

PHP shell tar problem, return code 2

Want to archive a folder using tar from PHP: $result = shell_exec("tar cf $sourceFile $sourceFolder -C $source > /dev/null; echo $?"); var_dump($result); Output: string(2) "2 " the > /dev/null; echo $? thing is for outputing the result code of a script under linux; the -C $source - changes to the right folder before doing anythi...

python tarfile adding files without directory hiearchy

When I invoke add() on a tarfile object with a file path, the file is added to the tarball with directory hiearchy associated .In other words, if I unzip the tarfile the directories in the original dir hiearchy are reproduced. Is there a way to simply add a plainfile without directory info that untarring the resulting tarball produce a ...

uncompressing tar.Z file with python ?

I need to write a python script that retrieves tar.Z files from an FTP server, and uncompress them on a windows machine. tar.Z, if I understood correctly is the result of a compress command in Unix. Python doesn't seem to know how to handle these, it's not gz, nor bz2 or zip. Does anyone know a library that would handle these ? Thanks ...

shell-scripting: Use a pipe as an input for tar

Hi there! I'm trying to figure out a way to use tar+pipes on a Ubuntu Server LTS. I've got a postgresql command (pg_dump) that outputs lots of sql on the standard output: pg_dump -U myUser myDB I know how to redirect that to a file: pg_dump -U myUser myDB > myDB.sql In order to save some disk space, I would rather have it compres...

Python: Pretty printing a xml file directly from a tar.gz package

This is the first Python script I've tried to create. I'm reading a xml file from a tar.gz package and then I want to pretty print it. However I can't seem to turn it from a file-like object to a string. I've tried to do it a few different ways including str(), tostring(), etc but nothing is working for me. For testing I just tried to...

How to parse a tar file in C++

What I want to do is download a .tar file with multiple directories with 2 files each. The problem is I can't find a way to read the tar file without actually extracting the files (using tar). The perfect solution would be something like: #include <easytar> Tarfile tar("somefile.tar"); std::string currentFile, currentFileName; for(int...

How can I tar multiple files in Perl?

How can I tar multiple directories and also append files with some pattern like '.txt' and exclude some directories and exclude some patterns like '.exe' all into a single tar file. The main point is the number of directories are unknown(dynamic), so I need to loop through I guess? ...