LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-09-2012, 06:46 AM   #1
SiphoMoon
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
copying zipped folders with html files inside


from a directory (usr/share/doc) that contains multiple folders, zipped and unzipped, how do I copy those that are zipped (tar, tgz, gz, etc) with html files inside into another directory (directpry A)?
 
Old 05-09-2012, 07:20 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
tar is NOT a zipped file in and of itself - it is simply a bundle of files. zip implies compression and a .tar isn't compressed at all. A .tar.gz or .tgz IS a gzipped TAR file (that is both bundled and compressed). A .gz file is compressed but may not necessarily be a bundle. A zip (which is different than gzip) is compressed and usually a bundle but a zip could contain just one file.

Your question is a little difficult to answer because there is no way to readily tell which files have html files in them without running other commands.

For example to see what was in a .tar or .tar.gz (.tgz) you could run:
tar tvf <filename> |grep -i htm

The command to see what was in a zip would be different.

You'd essentially need to write a script that:
1) Found all files that were of the types you specified.
2) Determined WHICH type (e.g. gzip or zip) the file was.
3) Ran the command to examine the contents of the file based on its type to determine if it contained htm files.
4) Do the copy of the file to new directory if it did contain such files.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Copying the files inside a folder, without copying the folder (hopefully easy) tibberous Linux - Software 3 12-23-2010 01:50 AM
Copying folders and the files in them SP7 Linux - Software 1 01-26-2010 04:47 AM
How to unzip files recursively inside folders? jessdog9001 Linux - Software 2 03-22-2006 12:59 PM
Copying files from multiple folders into one aardwolf64 Linux - General 4 01-02-2006 11:53 PM
downloading zipped folders geminigal Linux - Newbie 1 05-25-2005 04:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration