I have created a function that looks for a folder in a particular directory, checks the date it was last modified and if its old then compress it.
This works fine for files using gzip. However for folders I had to use tar. This is my function:
the equivalent funtion for compressing old files uses
which works fine...
the problem with the tar one is I get an error message saying "Cannot write to a directory"
If I replace "{}" with for eg " Archive1 " then it works fine, however what I want it to do is find the folder and compress it, not create a new separate archive
for example if I have the following directories
Folder1
--Nov2010
--Dec2010
I want the function to compress those two folders to
Folder1
--Nov2010.tar.gz
--Dec2010.tar.gz
(Nov2010 and Dec2010 are located inside Folder1 hence the "--")
Hi,
I want to extract myfile.war to a folder which is in the same folder with war file.I did this as normal:
jar -xvf myfile.war
But it exploded all the content of file to the same level folder instead of that I was expecting to create a folder called myfile.
This works with tar:
... (0 Replies)
Hi all,
4 files are returned when i issue 'find . -mtime -1 -type f -ls'.
./ora_475244.aud
./ora_671958.aud
./ora_934052.aud
./ora_934050.aud
However, when I issued the below command:
tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Hi all,
*I use Uwin and Cygwin emulator.
I´m trying to search for all text files in the current folder (C/Files) and its sub folders using
find -depth -name "*.txt"
The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Hi all I'm new to your forum but not new to shells. I'm having a little trouble though as it's been quite some time since I scripted. Here's what I'm trying to do:
I'm trying to search a directory named '/var/root/Applications' for another directory 'fooBar'. The "Applications" directory... (9 Replies)
Hi All-
I want to extract a particular folder from .tar format files.
For example:
File Name: backup.tar
The backup.tar contains the below folders & files.
1) /root_folder/Folder1/Folder1-1/*
2) /root_folder/Folder1/Folder1-2/*
3) /root_folder/Folder2/Folder2-1/*
4)... (5 Replies)
Hello guys,
I am sure this has been asked before, but honestly, I cant find post talking about it.
Here is what I need:
- A tar file will be generated manually by user
- This tar file is then used within a bash shell script
My source folder structure is like this:
... (2 Replies)
How do I create individual tars of a all the directories in a directory? I have a directory called 'patients', each patient has a directory in the patients directory. I want to create tars such that each patient has their own tar file.
Thanks! (5 Replies)
I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it.
Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem?
tar tvf file1.tar
... (1 Reply)
I have a tar file hello.tar which is 95 GB.
hello.tar has many files and folders including some tar files as well.
I wish to create a new tar ball which should maintain only the folder structure of hello.tar and the tar ball within the hello.tar
So basically the idea is to untar... (2 Replies)
Discussion started by: mohtashims
2 Replies
LEARN ABOUT CENTOS
sendfiles
SENDFILES(1) [nmh-1.5] SENDFILES(1)NAME
sendfiles - send multiple files via a MIME message
SYNOPSIS
sendfiles [delay] mailpath subject file1 [file2 ...]
DESCRIPTION
The shell script sendfiles, is used to send a collection of files and directories via electronic mail.
sendfiles mailpath "subject" files ...
sendfiles will archive the files and directories you name with the tar command, and then mail the compressed archive to the "mailpath" with
the given "subject". The archive will be automatically split up into as many messages as necessary in order to get past most mailers.
Sometimes you want sendfiles to pause after posting a partial message. This is usually the case when you are running sendmail and expect
to generate a lot of partial messages. If the first argument given to sendfiles starts with a dash, then it is interpreted as the number
of seconds to pause in between postings, e.g.,
sendfiles -30 mailpath "subject" files ...
will pause 30 seconds in between each posting.
Extracting the Received Files
When these messages are received, invoke mhstore once for the list of messages. The default is for mhstore to store the combined parts as
a new message in the current folder, although this can be changed using storage formatting strings. You can then use mhlist to find out
what's inside; possibly followed by mhstore again to write the archive to a file where you can subsequently uncompress and untar it. For
instance:
% mhlist 5-8
msg part type/subtype size description
5 message/partial 47K part 1 of 4
6 message/partial 47K part 2 of 4
7 message/partial 47K part 3 of 4
8 message/partial 18K part 4 of 4
% mhstore 5-8
reassembling partials 5,6,7,8 to folder inbox as message 9
% mhlist -verbose 9
msg part type/subtype size description
9 application/octet-stream 118K
(extract with uncompress | tar xvpf -)
type=tar
conversions=compress
% mhstore 9
% uncompress < 9.tar.Z | tar xvpf -
Alternately, by using the -auto switch, mhstore will automatically do the extraction for you:
% mhlist 5-8
msg part type/subtype size description
5 message/partial 47K part 1 of 4
6 message/partial 47K part 2 of 4
7 message/partial 47K part 3 of 4
8 message/partial 18K part 4 of 4
% mhstore 5-8
reassembling partials 5,6,7,8 to folder inbox as message 9
% mhlist -verbose 9
msg part type/subtype size description
9 application/octet-stream 118K
(extract with uncompress | tar xvpf -)
type=tar
conversions=compress
% mhstore -auto 9
-- tar listing appears here as files are extracted
As the second tar listing is generated, the files are extracted. A prudent user will never put -auto in the .mh_profile file. The correct
procedure is to first use mhlist to find out what will be extracted. Then mhstore can be invoked with -auto to perform the extraction.
FILES
$HOME/.mh_profile The user profile
PROFILE COMPONENTS
Path: To determine the user's nmh directory
Current-Folder: To find the default current folder
SEE ALSO mhbuild(1), mhlist(1), mhshow(1), mhstore(1). Proposed Standard for Message Encapsulation (RFC-934)
DEFAULTS
`-noverbose'
CONTEXT
None
MH.6.8 11 June 2012 SENDFILES(1)