Sponsored Content
Top Forums Shell Programming and Scripting How to tar all executable file in a directory Post 302331557 by kshji on Monday 6th of July 2009 02:25:57 PM
Old 07-06-2009
If you need all those files which have execute priviledges:
Code:
tmf=$$.tar.txt
> $tmf
for f in some*
do
     [ -x "$f" ] && echo "$f" >> $tmf
done
tar -cvfF xx.tar "$f"
rm -f "$f"

Or using file cmd output
Code:
tmf=$$.tar.txt
> $tmf
for f in *
do
     filetype=$( file "$f" )
     case "$filetype" in
              *ELF*)  echo "$f" >> $tmf ;;
     esac
done
tar -cvfF xx.tar "$f"
rm -f "$f"

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

extract a sub directory form a tar file

anyone know if it is possable to extract a subdirectory in a tar file. IE tarfile contains parent dir -sub dir A -sub dir B I want to extract sub dir B. (2 Replies)
Discussion started by: Optimus_P
2 Replies

2. Shell Programming and Scripting

TAR manipulation of file directory

I want to insert file to tar file (by tar command). The file is currently in a diffrenet directory and i want to be saved at the tar file as it was in other directory. I write the script in korn shell. How can i do it? (0 Replies)
Discussion started by: arielromi
0 Replies

3. UNIX for Dummies Questions & Answers

file restoration to new directory - tar command

hi, i face some problem which need URGENT assistance. am performing a restoration for recovery in an AIX UNIX server. when i use the tar -tvf command to view the tape contents, it gives me /ata1/mydir/myfile. i understand that how the file was backed up determine whether we could restore... (2 Replies)
Discussion started by: newbie168
2 Replies

4. UNIX and Linux Applications

Tar executable

Hi, I need to download tar.exe to archive the files before doing gzip...... I downloaded the executables from Browse GnuWin Files on SourceForge.net but my concern is whether this particular exe is safe to use? is it a licensed version? Have anybody downloaded from this site? Need ur advice. (2 Replies)
Discussion started by: Codesearcher
2 Replies

5. Shell Programming and Scripting

Tar file with logging and directory via parameter

Hi all, I am fairly new to shell scripting and I am trying the following: My shell script creates a tar file with files with the ending ~. The directory - where the files and sub directories are located - comes as a parameter when I call the script. Files that are archived will be written in... (1 Reply)
Discussion started by: neg42
1 Replies

6. Solaris

HOW TO extract.tar file to specific directory..?

Hi all, In Solaris howto extract tar file to specific folder. This is what we do in Linux, but how to do the same thing in Solaris ? -tar -xzvf /tmp/etc.tar.bz -C /tmp (Will extract in /tmp dir) 3.gzip COMPRESSION AND EXTRACTION -tar -czvf /tmp/etc.tar.bz /etc -du ... (5 Replies)
Discussion started by: manalisharmabe
5 Replies

7. Shell Programming and Scripting

Extract a single file from a tar file to another directory

Hi, I need to extract a single file from a tar file to another directory. So far I have this: This one extract a single file to same directory: tar -xvf filename.tar ./file.txt I tried this but its not working tar -xvf filename.tar /home/dir ./file.txt or this: (6 Replies)
Discussion started by: erin00
6 Replies

8. UNIX for Dummies Questions & Answers

No such file or directory for existing executable

Hi, I have a very puzzling problem. I have a binary file, it is executable but it says "No such file or directory" when I try to run it : root@debian:~# ls -l bmcfwul -rwxr-xr-t 1 root root 762808 Mar 11 2010 bmcfwul root@debian:~# ./bmcfwul -su: ./bmcfwul: No such file or directory... (9 Replies)
Discussion started by: chebarbudo
9 Replies

9. AIX

Making Tar of directory and tar file is going to be placed

Quick question, is it possible to make a Tar of completely directory and placing the tar file in it (will this cause even the tar file to tarred ?) sample: /opt/freeware/bin/tar -cvf - /oracle | gzip > /oracle/backup.tgz will the tar file backup.tgz also include backup.tgz ? i tried... (5 Replies)
Discussion started by: filosophizer
5 Replies

10. Shell Programming and Scripting

Script to Tar file in a specific Directory

I'm trying to write a Unix script that will go to a specific directory (/tmp/Sanbox/logs) and tar.gz all the log files in that directory and delete the original files that are older than 2 days. So far I have this but it doesn't work. Any help would be appreciated. #!/bin/bash ... (7 Replies)
Discussion started by: Loc
7 Replies
Arch::Tarball(3pm)					User Contributed Perl Documentation					Arch::Tarball(3pm)

NAME
Arch::Tarball - an interface to create and work with tarballs SYNOPSIS
use Arch::Tarball my $tarball = Arch::Tarball->new; my $pipe = $tarball->create( dir => '/path/to/subdir-to-pack', base_name => 'new-subdir-to-pack', pipe => 1, ); DESCRIPTION
Arch::Tarball provides an object oriented interface to work with (create, examine or extract) standard gzipped tarballs. Note: As functionality is added only when needed, a lot of features are currently not implemented. METHODS
The following functions are available: new, create, extract, list. new %opts Creates a new Arch::Tarball object. The following parameters can be set via %opts: tar The name of the tar executable. Defaults to "tar". file The filename of the Tarball. create %opts Creates a new tarball (tar.gz) from a given directory structure. create understands the following options: dir (mandatory) Specifies the base directory for the tarball. The given directory and recursively its content will be added to the tarball. The directory's basename will be used as the first and the only subdirectory in the tarball. base_name Allow the programmer to specify a different base directory name for the tarball content than the basename of dir. In this case, 'cp' process is launched to temporarily rename the last element of dir. pipe When set, create does not create a physical tarball but writes the tarballs content to a newly created pipe. The pipe is returned by the create method. Note: Currently the pipe option is mandatory. extract %opts Extracts the tarball to a given target directory, specified by dir option. If dir option is not given, a temporary directory is created that will hold the extracted dirs/files. This directory is returned. The file option specifies the tarball file name. It may be given in the constructor instead. list %opts (not implemented yet) Returns a list of files and directories in the tarball. BUGS
Most functionality is currently not implemented. If you need part of the missing functionality, please contact the authors. Patches are greatly appreciated. AUTHORS
Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel). Enno Cramer (uebergeek@web.de--2003/arch-perl--devel). perl v5.10.1 2005-04-22 Arch::Tarball(3pm)
All times are GMT -4. The time now is 01:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy