03-25-2008
unzip files in a different folder
hi ,
I am using this command to unzip files from a source
unzip -o $source_dir -d $dest_dir
butthe problem is that this command creates a new folder at the destination and unzips all the files in that folder.
I dont want that extra folder.
e.g
source_dir= abc/myname.zip
dest_dir=xyz/myname/*.pdf
whereas i want my dest_dir to be xyz/*.pdf
can some one please help me with this????
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello experts,
I run Solaris 9. I have a below script which is used for gunzip the thousand files from a directory.
----
#!/usr/bin/sh
cd /home/thousands/gzipfiles/
for i in `ls -1`
do
gunzip -c $i > /path/to/file/$i
done
----
In my SAME directory there thousand of GZIP file and also... (4 Replies)
Discussion started by: thepurple
4 Replies
2. UNIX for Advanced & Expert Users
Hello all,
I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written.
I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies
3. Shell Programming and Scripting
Hi !
I am trying to automate FTP transfer of some folders from one unix machine (a) to another one (b).
I run my shell script on machine a.
The problem I face is how to unzip the folder at the machine b with script run in machine a.
My first question: Is there any way to do this ?
My... (10 Replies)
Discussion started by: siba
10 Replies
4. Shell Programming and Scripting
Hi,
I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server.
How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies
5. Shell Programming and Scripting
I have a folder (C:\shellprg\input\) containing .CSV, .zip, .gz files.
1] I want to find all .zip/.gz files from folder (C:\shellprg\input\).
2] unzip/uncompress files into the same folder (C:\shellprg\input\) through shell script.
I am using below commands for unzip files,
unzip <filename>... (2 Replies)
Discussion started by: Poonamol
2 Replies
6. Shell Programming and Scripting
Hi ,
I have two ear files in a single folder. the ear file contains same xml files named "File1.xml". how to unzip each file seperately using shell script?
Thanks,
Chella. (11 Replies)
Discussion started by: ckchelladurai
11 Replies
7. Shell Programming and Scripting
Hi all,
I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to
find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Discussion started by: pmkenya
2 Replies
8. Shell Programming and Scripting
Hi frnds,
My requirement is I have a zip file with name say eg: test_ABC_UH_ccde2a_awdeaea_20150422.zip
within that there are subdirectories on each directory we again have .zip files and in that we have files like mama20150422.gz and so on.
Iam in need of a bash script so that it unzips... (0 Replies)
Discussion started by: Ravi Kishore
0 Replies
9. Shell Programming and Scripting
I need help to write shell script to copy files from one server to another server.
Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Discussion started by: naresh2389
3 Replies
10. Shell Programming and Scripting
Hi Team,
I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder.
Eg:
parent folder --> /Interface/data/test/IN
Sub folder -->/Interface/data/test/IN/Invoice20180607233338
Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies
LEARN ABOUT DEBIAN
any::template::processdir
Any::Template::ProcessDir(3pm) User Contributed Perl Documentation Any::Template::ProcessDir(3pm)
NAME
Any::Template::ProcessDir -- Process a directory of templates
VERSION
version 0.07
SYNOPSIS
use Any::Template::ProcessDir;
# Process templates and generate result files in a single directory
#
my $pd = Any::Template::ProcessDir->new(
dir => '/path/to/dir',
process_text => sub {
my $template = Any::Template->new( Backend => '...', String => $_[0] );
$template->process({ ... });
}
);
$pd->process_dir();
# Process templates and generate result files to a separate directory
#
my $pd = Any::Template::ProcessDir->new(
source_dir => '/path/to/source/dir',
dest_dir => '/path/to/dest/dir',
process_file => sub {
my $file = $_[0];
# do something with $file, return content
}
);
$pd->process_dir();
DESCRIPTION
Recursively processes a directory of templates, generating a set of result files in the same directory or in a parallel directory. Each
file in the source directory may be template-processed, copied, or ignored depending on its pathname.
CONSTRUCTOR
Specifying directory/directories
o If you want to generate the result files in the same directory as the templates, just specify dir.
my $pd = Any::Template::ProcessDir->new(
dir => '/path/to/dir',
...
);
o If you want to generate the result files in a separate directory from the templates, specify source_dir and dest_dir.
my $pd = Any::Template::ProcessDir->new(
source_dir => '/path/to/source/dir',
source_dir => '/path/to/dest/dir',
...
);
Specifying how to process templates
process_file
A code reference that takes the full template filename and the "Any::Template::ProcessDir" object as arguments, and returns the result
string. This can use Any::Template or another method altogether. By default it calls "process_text" on the contents of the file.
process_text
A code reference that takes the template text and the "Any::Template::ProcessDir" object as arguments, and returns the result string.
This can use Any::Template or another method altogether.
Optional parameters
dir_create_mode
Permissions mode to use when creating destination directories. Defaults to 0775. No effect if you are using a single directory.
file_create_mode
Permissions mode to use when creating destination files. Defaults to 0444 (read-only), so that destination files are not accidentally
edited.
ignore_files
Coderef which takes a full pathname and returns true if the file should be ignored. By default, all files will be considered.
readme_filename
Name of a README file to generate in the destination directory - defaults to "README". No file will be generated if you pass undef or
if you are using a single directory.
template_file_suffix
Suffix of template files in source directory. Defaults to ".src". This will be removed from the destination file name.
Any file in the source directory that does not have this suffix (or "ignore_file_suffix") will simply be copied to the destination.
METHODS
process_dir
Process the directory. If using multiple directories, the destination directory will be removed completely and recreated, to eliminate
any old files from previous processing.
SEE ALSO
Any::Template
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-14 Any::Template::ProcessDir(3pm)