Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-28-2011, 08:22 AM   #1
Registered: Nov 2009
Posts: 45

Rep: Reputation: 15
Cent OS Linux i have lots of .zip files.

Cent OS Linux i have lots of .zip files. need to move some specifics files.

I have big no of .zip file in one directory .

when i am executing ls -ltr *.zip argument to long message.

I need to identified zip files in all as below logic.

I have below type of zip files containt.


Extract containt :


If .zip extract and if it has plu.iu inside i have to move those .zip files to other directory in loop for all present file from source directory.

if it not containt plu.iu extract part of zip it will keep it there in that location.

More important i dont want to do any extract of .zip files it should be work with out extract it containt should be read as it is .zip file and move to other location . also need to view or ls befor move .
Old 10-28-2011, 06:17 PM   #2
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
I'm not sure the following will gives the same "argument list too long" error, anyway you might give it a try:
for file in *.zip
  if unzip -l $file | grep -q plu.iu$
    mv $file /path/to/destination/dir
If you get the error above, we need to change the logic to avoid the usage of the huge list in a single statement/command.

To list the files, you can go up by one level and list the content of the directory, e.g
$ cd ..
$ ls directory_containing_zip_files/

Last edited by colucix; 10-28-2011 at 06:19 PM.


script, scripts, shell script, unix

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
Linux zip program's -d -tt option deletes all files from zip archive Arun Gupta Linux - Software 4 04-27-2011 08:06 PM
How to zip several files to several zip with one command? thomas2004ch Linux - Newbie 4 02-08-2010 09:13 AM
How do I extract password pretected .zip files in linux i_s Linux - General 2 03-25-2005 05:47 AM
Unzipping .zip files in linux dr_zayus69 Linux - Software 5 09-27-2004 07:47 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:15 AM.

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