Go Back   Android Forums > Android Community > The Lounge > Computers & IT

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

Like Tree4Likes
  • 1 Post By argedion
  • 1 Post By EarlyMon
  • 1 Post By 9to5cynic
  • 1 Post By EarlyMon

test: Reply
 
LinkBack Thread Tools
Old November 14th, 2012, 08:31 PM   #1 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default help with 7za

I need to exclude zip files from an archive that will be regulary updated. does anyone know how to do this I have tried several different ways

7za -ax{*.zip;*.7z} archive.7z sdd/stuff
7za archive.7z sdd/stuff -x{*.zip;*.7z}

all return error "Incorrect command line"

any help would be appreciated

thanks

__________________
All My Links In one Convenient Place
Asking simple questions can keep us from doing dumb things.
argedion is online now  
Reply With Quote
sponsored links
Old November 15th, 2012, 12:01 AM   #2 (permalink)
Senior Member
 
9to5cynic's Avatar
 
Join Date: Feb 2011
Location: /home/
Posts: 4,858
 
Device(s): Galaxy S3 (Verizon) Evo 4G - retired/rooted
Carrier: Verizon

Thanks: 3,066
Thanked 1,762 Times in 1,189 Posts
Send a message via AIM to 9to5cynic
Default

Hmm.. I don't this is 100% what you were going for, but I *think* it'll work.

I did this with 7zr by they way... I think it's quite similar.

Code:
ls /your/dir | grep -v ".7z" | grep -v ".zip" > /tmp/out.1
7zr a arch1.7z @/tmp/out.1
I tried it a few ways before and I was getting the same error you were. I think it has to do with the brace expansion, but I'm not sure. This just creates a list file and then calls that list file.

Hope that helps.
9to5cynic is offline  
Reply With Quote
The Following 2 Users Say Thank You to 9to5cynic For This Useful Post:
argedion (November 15th, 2012), EarlyMon (November 16th, 2012)
Old November 15th, 2012, 04:16 PM   #3 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default

not having any luck there either
argedion is online now  
Reply With Quote
Old November 15th, 2012, 04:53 PM   #4 (permalink)
Senior Member
 
9to5cynic's Avatar
 
Join Date: Feb 2011
Location: /home/
Posts: 4,858
 
Device(s): Galaxy S3 (Verizon) Evo 4G - retired/rooted
Carrier: Verizon

Thanks: 3,066
Thanked 1,762 Times in 1,189 Posts
Send a message via AIM to 9to5cynic
Default

Quote:
Originally Posted by argedion View Post
not having any luck there either
Shoot. Maybe 7za and 7zr are not as similar as I thought....

How is your archive directory set up? Is it all files in one directory - or are there multiple directories?

Hmm... What error are you getting? That same one with Incomplete command or whatever it said?
9to5cynic is offline  
Reply With Quote
The Following User Says Thank You to 9to5cynic For This Useful Post:
argedion (November 15th, 2012)
Old November 15th, 2012, 05:22 PM   #5 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

From the man page -

-x[r[-|0]]]{@listfile|!wildcard}

So, doesn't !wildcard mean that no wildcards are allowed?

Maybe better to create a list of the files you want to exclude and then input that list?
EarlyMon is offline  
Reply With Quote
The Following 2 Users Say Thank You to EarlyMon For This Useful Post:
9to5cynic (November 15th, 2012), argedion (November 15th, 2012)
Old November 15th, 2012, 06:30 PM   #6 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default

Quote:
Originally Posted by 9to5cynic View Post
Shoot. Maybe 7za and 7zr are not as similar as I thought....

How is your archive directory set up? Is it all files in one directory - or are there multiple directories?

Hmm... What error are you getting? That same one with Incomplete command or whatever it said?
as a test I was doing ~/Downloads/temp I had a zip file in temp along with some other regular files everytime I do something similar to this

7za a temp.7z ~/Downloads/temp -x!*.zip
I get the error of it still zipping the zip file if i add the " r -x!" then i get incorrect command

IF I SHOOT IT THEN I GET A INCORRECT COMMAND WITH A CRACKED SCREEN.


@Early
Yeah I have done that I have done -ax I have put it up front of the commands, behind them and still get the same thing either it will make the archive adding the zip file or it gives me the incorrect command error.

Basically when I zip up the contents from my SDCARD in the phone I want to archive everthing except for the stuff that is already in archive format. no need to compress that stuff again. I guess I may have to go through and remove the zips before I run my bash to zip the sdcard up. I was going to put this in conjuction with my other bash that copies the entire content of the sdcards using adb command.
I was going to automate the process of compressing those backups and removing everything from the original except the archived files that were there. I could then rsync to an archived folder those files and then delete the source files and finally delete the empty directorys.

Sounds simple right???????
Speed Daemon likes this.
argedion is online now  
Reply With Quote
Old November 15th, 2012, 08:55 PM   #7 (permalink)
Senior Member
 
9to5cynic's Avatar
 
Join Date: Feb 2011
Location: /home/
Posts: 4,858
 
Device(s): Galaxy S3 (Verizon) Evo 4G - retired/rooted
Carrier: Verizon

Thanks: 3,066
Thanked 1,762 Times in 1,189 Posts
Send a message via AIM to 9to5cynic
Default

Quote:
Originally Posted by EarlyMon View Post
From the man page -

-x[r[-|0]]]{@listfile|!wildcard}

So, doesn't !wildcard mean that no wildcards are allowed?

Maybe better to create a list of the files you want to exclude and then input that list?
I saw that, I didn't get it. But that makes sense (the ! and all).... what's the part with square brackets mean?

Quote:
Originally Posted by argedion View Post
as a test I was doing ~/Downloads/temp I had a zip file in temp along with some other regular files everytime I do something similar to this

7za a temp.7z ~/Downloads/temp -x!*.zip
I get the error of it still zipping the zip file if i add the " r -x!" then i get incorrect command

IF I SHOOT IT THEN I GET A INCORRECT COMMAND WITH A CRACKED SCREEN.


@Early
Yeah I have done that I have done -ax I have put it up front of the commands, behind them and still get the same thing either it will make the archive adding the zip file or it gives me the incorrect command error.

Basically when I zip up the contents from my SDCARD in the phone I want to archive everthing except for the stuff that is already in archive format. no need to compress that stuff again. I guess I may have to go through and remove the zips before I run my bash to zip the sdcard up. I was going to put this in conjuction with my other bash that copies the entire content of the sdcards using adb command.
I was going to automate the process of compressing those backups and removing everything from the original except the archived files that were there. I could then rsync to an archived folder those files and then delete the source files and finally delete the empty directorys.

Sounds simple right???????
Hmm... I'd play around with that ls into grep I had up a few posts... that *should* be doing that.
When I tested it with 7zr, it would list the contents of my directory except anything with a zip or 7z file extension... and it would use that as the include list.
9to5cynic is offline  
Reply With Quote
The Following 2 Users Say Thank You to 9to5cynic For This Useful Post:
argedion (November 15th, 2012), EarlyMon (November 16th, 2012)
Old November 15th, 2012, 09:41 PM   #8 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

Anything in brackets means optional and an exclamation mark means not.

{|} means use one or the other on either side of the bar. The {|} aren't part of the command sequence.

That's usually how those work.

argedion - can you use a script to add files to the archive in a loop provided their not already zips?
EarlyMon is offline  
Last edited by EarlyMon; November 15th, 2012 at 09:46 PM.
Reply With Quote
The Following 2 Users Say Thank You to EarlyMon For This Useful Post:
9to5cynic (November 16th, 2012), argedion (November 15th, 2012)
Old November 15th, 2012, 11:38 PM   #9 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default

Quote:
Originally Posted by EarlyMon View Post
Anything in brackets means optional and an exclamation mark means not.

{|} means use one or the other on either side of the bar. The {|} aren't part of the command sequence.

That's usually how those work.

argedion - can you use a script to add files to the archive in a loop provided their not already zips?
not sure i haven't done that before but i haven't done this before either so its all new to me. I will play around this weekend and see what I can come up with. I'll try using grep and make a list as 9to5 suggest.
argedion is online now  
Reply With Quote
Old November 16th, 2012, 12:40 AM   #10 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

ls | sed '/zip$/d' | sed '/7z$/d' > /tmp/zip_list

LoL I just went back and looked at 9to5's list maker, same thing. The dollar says to match the pattern only to end of the line.
9to5cynic likes this.
EarlyMon is offline  
Last edited by EarlyMon; November 16th, 2012 at 02:16 PM.
Reply With Quote
The Following User Says Thank You to EarlyMon For This Useful Post:
9to5cynic (November 16th, 2012)
sponsored links
Old November 16th, 2012, 01:09 PM   #11 (permalink)
Senior Member
 
9to5cynic's Avatar
 
Join Date: Feb 2011
Location: /home/
Posts: 4,858
 
Device(s): Galaxy S3 (Verizon) Evo 4G - retired/rooted
Carrier: Verizon

Thanks: 3,066
Thanked 1,762 Times in 1,189 Posts
Send a message via AIM to 9to5cynic
Default

I'm going to finally have to learn sed and awk one of these days...
Speed Daemon likes this.
9to5cynic is offline  
Reply With Quote
Old November 16th, 2012, 02:18 PM   #12 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

Quote:
Originally Posted by 9to5cynic View Post
I'm going to finally have to learn sed and awk one of these days...
Indispensable but pricy - sed & awk, 2nd Edition*-*O'Reilly Media

See also -

Sed - An Introduction and Tutorial

Awk - A Tutorial and Introduction - by Bruce Barnett

Bourne Shell Tutorial
9to5cynic likes this.
EarlyMon is offline  
Last edited by EarlyMon; November 16th, 2012 at 02:28 PM.
Reply With Quote
The Following 2 Users Say Thank You to EarlyMon For This Useful Post:
9to5cynic (November 16th, 2012), argedion (November 16th, 2012)
Old November 16th, 2012, 05:46 PM   #13 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default

when i last did it this morning it made the list but still tried to archive a zip file so not sure what i did wrong will play with it some this evening if i feel like it. right now i'm battling being sick
argedion is online now  
Reply With Quote
Old November 16th, 2012, 06:07 PM   #14 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

Quote:
Originally Posted by argedion View Post
when i last did it this morning it made the list but still tried to archive a zip file so not sure what i did wrong will play with it some this evening if i feel like it. right now i'm battling being sick
Sorry to hear that.

If you get a chance, attach the list file here.
EarlyMon is offline  
Reply With Quote
Old November 16th, 2012, 06:19 PM   #15 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default

Quote:
Originally Posted by EarlyMon View Post
Sorry to hear that.

If you get a chance, attach the list file here.
its to big for me to attach here let me see if i can get it in drop box and get you a link for it.

here try this:
http://dl.dropbox.com/u/38130332/xclude.txt
argedion is online now  
Reply With Quote
Old November 16th, 2012, 06:21 PM   #16 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

The list file is too big???
EarlyMon is offline  
Reply With Quote
Old November 16th, 2012, 06:23 PM   #17 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default

Quote:
Originally Posted by EarlyMon View Post
The list file is too big???
only by a hundred kb or so thats all

line number 6184 is where i have the problem even though nothing is in the list there (all zips in that folder) it starts copying the zip files anyways
argedion is online now  
Last edited by argedion; November 16th, 2012 at 06:25 PM.
Reply With Quote
Old November 16th, 2012, 06:49 PM   #18 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

Attach plain zip of list file?
EarlyMon is offline  
Reply With Quote
Old November 16th, 2012, 07:25 PM   #19 (permalink)
The TechnoFrog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: The Severed Garden
Posts: 5,524
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 5,565
Thanked 5,325 Times in 2,470 Posts
Default

Quote:
Originally Posted by EarlyMon View Post
Attach plain zip of list file?
have drop box addy a few post up
argedion is online now  
Reply With Quote
The Following User Says Thank You to argedion For This Useful Post:
EarlyMon (November 16th, 2012)
Old November 16th, 2012, 07:32 PM   #20 (permalink)
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 44,042
 
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint

Thanks: 41,701
Thanked 54,832 Times in 21,868 Posts
Default

Yeah, that's not going to work, the directory references override the file specifications, that's why zips are being included.

Seems like an adb pull followed by a local zip would be more effective, time wise.

I'll help chew this over and give more options, after pondering...
EarlyMon is offline  
Reply With Quote
The Following User Says Thank You to EarlyMon For This Useful Post:
argedion (November 16th, 2012)
sponsored links
Old November 18th, 2012, 05:51 PM   #21 (permalink)
Disabled
 
Join Date: Jul 2012
Posts: 2,033
 
Device(s):
Carrier: Sprint

Thanks: 541
Thanked 556 Times in 440 Posts
Default

Quote:
Originally Posted by 9to5cynic View Post
I'm going to finally have to learn sed and awk one of these days...
Regular expressions are the answer to this without a doubt, and to learn sed and awk you need to know regular expressions.

It's been a while since I've written a script for 7za so the examples that I have may not be up to date. If not too much has changed, you should be able to pipe the output of something like `find' into 7za on the same command line. Something like :

find (args) | 7za a -t7z -mx=9 -mmt=on myfile.7z -

will pipe the stdout of find into stdin of 7za, eliminating the need for an intermediate file. Although I'm really rusty on find, I know it can do what you want because I've seen people do it that way.

Now let me see if my O'Reilly "Regular Expressions" book is reachable...
Speed Daemon is offline  
Reply With Quote
The Following 2 Users Say Thank You to Speed Daemon For This Useful Post:
9to5cynic (November 18th, 2012), argedion (November 18th, 2012)
Reply


Go Back   Android Forums > Android Community > The Lounge > Computers & IT
Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 08:23 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.