-   Linux - Newbie (
-   -   Cent OS Linux i have lots of .zip files. (

dhirendrs 10-28-2011 07:22 AM

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 .

colucix 10-28-2011 05:17 PM

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/

All times are GMT -5. The time now is 02:23 PM.