LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-18-2012, 06:00 AM   #1
sarelnet
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Rep: Reputation: Disabled
zip file script with date concatenation - centOS


Hi,
I've tried to make bash script in order to backup my svn:
Code:
#!/bin/bash
ZIPFN="bu-$(date +\%Y.\%m.\%d_\%H.\%M.\%S).zip"
zip -r svn-backup/$ZIPFN svn/trunk/ -x "*/.svn/*"
It doesn't work.

OS: centOS x64

Thanks!
 
Old 01-18-2012, 06:35 AM   #2
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by sarelnet View Post
Hi,
Code:
ZIPFN="bu-$(date +\%Y.\%m.\%d_\%H.\%M.\%S).zip"

Hi,

try this
Code:
ZIPFN="bu-$(date +"%Y.%m.%d_%H.%M.%S").zip"
 
Old 01-18-2012, 06:38 AM   #3
sarelnet
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
---

Ain't working.
(It works partially - but zip includes svn directories. The code I gave does the same).

Thanks anyway
 
Old 01-19-2012, 01:47 AM   #4
sarelnet
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
update...

Hi,
the following script prints (echo):
Code:
zip -r svn-backup/proj-backup-2012-01-19_09-42-41.zip svn/trunk/ -x "*/.svn/*"
Now comes the very weird part:
When it runs - it saves .svn folders and files in it (not good).
When I use this line in bash - it works perfectly (doesn't saves .svn folders and files in it)

Any suggestions?

Code:
#!/bin/bash
ZIPFN="zip -r svn-backup/proj-backup-"$(date +"%Y-%m-%d_%H-%M-%S")".zip svn/trunk/ -x "'"*/.svn/*"'
echo $ZIPFN
$ZIPFN
 
Old 01-19-2012, 08:26 AM   #5
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
I could only point you to example excluding with ZIP
if you try it out.
I don't use zip just because of this problems (excluding) so I use Tar. sorry.

good luck
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to traverse into sub-directory and replace line of file inside zip Marshalle Linux - General 2 08-27-2010 11:38 PM
how to increment the date in a file name via bash script tensigh Programming 10 07-23-2010 03:49 AM
Create a script that asks the user for a file and then appends the date to the file larry5757 Linux - Newbie 2 12-04-2009 06:33 AM
csh Shell Script: String Concatenation, how do i add a new line character? vxc69 Programming 1 05-04-2009 07:51 PM
shell script to find modified date and last accessed date of any file. parasdua Linux - Newbie 6 04-22-2008 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:54 AM.

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