LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 02-09-2011, 05:03 AM   #1
MODYSAMA
Member
 
Registered: Dec 2010
Posts: 144

Rep: Reputation: 0
Exclamation [Appended] Advanced Zipping cmd?


Hello, It'd be great If I get help.
Let:
  • Source directory is /x/y/z/src:
  • Destination is /x/y/z/dst,
Q: What is the option in zip command, which zip all updated or new picture files (*.jpg) from the source path to the destination + don't keep the origional files -zipping while moving- ?


Thanks in advanced.
Interested Linux Beginner

Last edited by MODYSAMA; 04-19-2011 at 09:54 AM.
 
Old 02-09-2011, 05:29 AM   #2
goodhombre
Member
 
Registered: Mar 2010
Location: Ungheni, Rep. Moldova
Distribution: Ubuntu
Posts: 89

Rep: Reputation: 22
Hi,

rsync can do that , it should be smth like :
Code:
rsync -avz --remove-source-files --include='*.jpg' /x/y/z/src/ /x/y/z/dst/
See man rsync for more information.

Also there is --update option for tar for archive updating, but I don't think an option for deleting source files exits in tar. For more in formations : man tar

Last edited by goodhombre; 02-09-2011 at 05:35 AM.
 
1 members found this post helpful.
Old 02-09-2011, 05:31 AM   #3
appilu
Member
 
Registered: Jan 2011
Distribution: RedHat,Debian-Ubuntu,Fedora
Posts: 73

Rep: Reputation: 8
Hi,
ihave seen a option update (-u) in zip command.May be it can help you.
 
1 members found this post helpful.
Old 02-09-2011, 07:05 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Quote:
Originally Posted by MODYSAMA View Post
Hello, It'd be great If I get help.
Let:
  • Source directory is /x/y/z/src:
  • Destination is /x/y/z/dst,
Q: What is the option in zip command, which zip all updated or new picture files (*.jpg) from the source path to the destination + don't keep the origional files -zipping while moving- ?


Thanks in advanced.
Interested Linux Beginner
You have been posting homework style questions lately.

You do need to make some effort towards learning and not expecting LQ members to just be your help desk.
Quote:
Do not expect LQ members to do your homework - you will learn much more by doing it yourself.
As stated from the LQ Rules above, it would benefit you to do the work. We will aid you but not do the work for you!


"Knowledge is of two kinds. We Know a subject ourselves, or we know where we can find information upon it."- Samuel Johnson

You can find a lot of useful information to aid you to gaining some understanding here at LQ via Search.

Below you will find links that will help, sure some may seem beyond a newbie skill level but you must start somewhere;



Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Utimate Linux Newbie Guide
LinuxSelfHelp
Bash Beginners Guide
Bash Reference Manual
Advanced Bash-Scripting Guide
Linux Home Networking



The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
1 members found this post helpful.
Old 02-09-2011, 07:20 AM   #5
MODYSAMA
Member
 
Registered: Dec 2010
Posts: 144

Original Poster
Rep: Reputation: 0
Arrow

onebuck,
I am in The Engineering Graduation Year, not student need to find someone solving homework.In addaition to need help, I perform search to find what I need myself.
You can check my posts. It's my style presenting questions
.



Thanks for your comment.Useful links and I need it.
Linux Interested Beginner

Last edited by MODYSAMA; 02-09-2011 at 07:23 AM.
 
Old 02-09-2011, 07:53 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Quote:
Originally Posted by MODYSAMA View Post
onebuck,
I am in The Engineering Graduation Year, not student need to find someone solving homework.In addaition to need help, I perform search to find what I need myself.
You can check my posts. It's my style presenting questions
.

Thanks for your comment.Useful links and I need it.
Linux Interested Beginner
Glad to hear your graduating. It's good to clarify and present your position(s). Your style does come across as verbatim homework. I have been reading across the forum(s) and your post(s) came across as homework.

Yes, the links that were provided will answer a lot of your questions. Read and learn but when something is not clear then present your queries.

Don't forget the LQ Search since it is likely that your question or problem has already been covered.

"You must look into people as well as at them."-Chesterfield
 
Old 02-09-2011, 08:19 AM   #7
MODYSAMA
Member
 
Registered: Dec 2010
Posts: 144

Original Poster
Rep: Reputation: 0
Question

Code:
rsync -avz --remove-source-files --include='*.jpg' /x/y/z/src/ /x/y/z/dst/
  • That cmd does the zipping operation during the transformation period to acheive something like security + transperance + minimize the delay.But that commend doesn't reach the targects into destination in the zip format!?

Last edited by MODYSAMA; 02-09-2011 at 08:23 AM.
 
Old 02-09-2011, 09:06 AM   #8
goodhombre
Member
 
Registered: Mar 2010
Location: Ungheni, Rep. Moldova
Distribution: Ubuntu
Posts: 89

Rep: Reputation: 22
Hi,

Yes I know.

But you can combine it with an archive tool.
unzip -> update using rsync -> zip back .
 
1 members found this post helpful.
Old 02-09-2011, 02:08 PM   #9
MODYSAMA
Member
 
Registered: Dec 2010
Posts: 144

Original Poster
Rep: Reputation: 0
Hi,
I faild do it. I tried
Code:
rsync -av --compress --remove-source-files  /home/sok/Documents/*.jpg /home/sok/Receive/
But pictures arrive unzipped. :-(
Q: How is zip back?
 
Old 02-09-2011, 03:06 PM   #10
goodhombre
Member
 
Registered: Mar 2010
Location: Ungheni, Rep. Moldova
Distribution: Ubuntu
Posts: 89

Rep: Reputation: 22
Hi,

As you said :

Quote:
Originally Posted by MODYSAMA View Post
Code:
rsync -avz --remove-source-files --include='*.jpg' /x/y/z/src/ /x/y/z/dst/
  • That cmd does the zipping operation during the transformation period to acheive something like security + transperance + minimize the delay.But that commend doesn't reach the targects into destination in the zip format!?
It compress data only to speed up transfer. If you use rsync to sync data on the same computer -z ( --compress ) option is useless .
 
1 members found this post helpful.
Old 02-09-2011, 03:21 PM   #11
MODYSAMA
Member
 
Registered: Dec 2010
Posts: 144

Original Poster
Rep: Reputation: 0
Hi goodhombre,
You mean at the same computer zipping with synchronization would be acheived !??Can't I reach the pictures zipped in the destination directory ?
Q: Can this operation be done using mv + zip command ?
 
Old 02-09-2011, 03:53 PM   #12
someshpr
Member
 
Registered: Jul 2009
Location: WI, USA
Distribution: Debian 8, Ubuntu 16.04, CentOS 7
Posts: 143

Rep: Reputation: 28
check: man zip

zip has an -u option for updating (as suggested by appilu) as well as a -m option that moves the source files to the zip archive (and hence deletes the source after archiving). Combination of these might help.
 
2 members found this post helpful.
Old 02-11-2011, 08:10 AM   #13
MODYSAMA
Member
 
Registered: Dec 2010
Posts: 144

Original Poster
Rep: Reputation: 0
I want compression command to recursive compression images but each image individual as a (compressed file) with out I give a name (command do that itself ) to them and arrive to the destination not as a folder.zip but each one .zip .
need help, please.

.zip commands I tried collect pictures to a one zip file. that's I don't want

Last edited by MODYSAMA; 02-11-2011 at 03:22 PM.
 
Old 02-11-2011, 03:24 PM   #14
MODYSAMA
Member
 
Registered: Dec 2010
Posts: 144

Original Poster
Rep: Reputation: 0
need help,please.
 
Old 02-11-2011, 04:04 PM   #15
someshpr
Member
 
Registered: Jul 2009
Location: WI, USA
Distribution: Debian 8, Ubuntu 16.04, CentOS 7
Posts: 143

Rep: Reputation: 28
Quote:
Originally Posted by MODYSAMA View Post
I want compression command to recursive compression images but each image individual as a (compressed file) with out I give a name (command do that itself ) to them and arrive to the destination not as a folder.zip but each one .zip .
need help, please.

.zip commands I tried collect pictures to a one zip file. that's I don't want
I don't think I understand your requirement clearly! Can you give an example?

Is it like that you have some jpeg pictures in your source directory (src) and you want to zip every jpeg files separately and store them in destination directory (dest) deleting the original jpeg files? I do not know of any single command to do that, you may have to write a small script like this:
Code:
cd /path-to-src/
JPG=`ls *.jpg`
for file in $JPG; do
  base=`basename $file .jpg`
  zip -m /path-to-dest/$base.zip $file
done;
Also, just an aside, I believe "zipping" a jpeg image doesn't really reduce the storage size much. JPEG is an already compressed file type. But I maybe wrong.
 
1 members found this post helpful.
  


Reply



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
Zipping multiple directories Wastedsanity Linux - Newbie 3 01-16-2011 07:33 PM
zipping a directory tractng Linux - Newbie 3 04-16-2008 04:54 PM
Zipping a folder Gins Linux - General 9 06-19-2007 05:17 PM
Zipping of files rajesh_b Programming 5 10-27-2004 06:02 AM
Zipping and Taring and ? Goatdemon Linux - Newbie 3 05-22-2002 07:17 AM

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

All times are GMT -5. The time now is 02:34 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