Date as suffix in rsync... what am I doing wrong?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Date as suffix in rsync... what am I doing wrong?
# 1  
Old 10-07-2012
Date as suffix in rsync... what am I doing wrong?

Code:
#!/bin/bash
currentdatee=$(date +%D-%R)
rsync -autb --backup-dir="/home/kyle/USBSYNC/OLDFILES/CRUZEREDGE1/" --suffix="$currentdatee" /mnt/backup/* /home/kyle/USBSYNC/CRUZEREDGE1/

The rsync line simply doesn't work when I try this. It'll work if I make the suffix something static. I feel dumb as this is so simple... I've tried every combination of single quotes, $, (), anything I can think of. It just doesn't want to work.
# 2  
Old 10-07-2012
The %D format of date uses slash characters between fields.
This character is used in unix as a directory indicator and isn't allowed in filenames.

Try a date format like currentdatee=$(date +%d_%m_%y-%R)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help Needed for creating the folder by checking today's date and, take backup using rsync command

How to create a shell script to create a folder by using the today's date to take backup using rsync command on every evening around 7 pm. Kindly help. Thanks. To be more precise, I want to create a script which matches the today's date with server's date format, if matches then creates the... (2 Replies)
Discussion started by: bakula10
2 Replies

2. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies

3. Shell Programming and Scripting

Rsync copying within recent date range?

As many will point out, one of the benefits of using rsync (without --delete) is that it will sync files between source and destination, but not delete files in the destination which HAVE been deleted in the source. Well, I have kind of the opposite problem and I'm wondering if there are date... (2 Replies)
Discussion started by: WIOP33
2 Replies

4. Shell Programming and Scripting

Rsync script to rewrite suffix - BASH, awk, sed, perl?

trying to write up a script to put the suffix back. heres what I have but can't get it to do anything :( would like it to be name.date.suffix rsync -zrlpoDtub --suffix=".`date +%Y%m%d%k%M%S`.~" --bwlimit=1024 /mymounts/test1/ /mymounts/test2/ while IFS=. read -r -u 9 -d '' name... (1 Reply)
Discussion started by: jmituzas
1 Replies

5. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

6. Solaris

v240 -- wrong date

after shutting down the server and the ILOM/ALOM, its date seems to go back to 1977..rather than current date.. problem with battery on ILOM/ALOM ??:( (1 Reply)
Discussion started by: ppchu99
1 Replies

7. Shell Programming and Scripting

RSYNC syntax for pushing file with latest system date

OK, I am a little new to AIX 5.3 and also to scripting. I have a shell script that I wrote and am having difficulty pushing specific files by the system date. Here is my script: #!/usr/bin/sh RSYNC=/usr/local/bin/rsync SSH=/usr/local/bin/ssh KEY=<path> somekey.key RUSER=mike... (4 Replies)
Discussion started by: tfort73
4 Replies

8. Shell Programming and Scripting

rsync to update "Date Modified"

Is there anyway to get rsync to also modify the date modified details of the files it has updated? It would be useful to easily check that the rysnc has performed as expected.. (4 Replies)
Discussion started by: timgolding
4 Replies

9. UNIX for Advanced & Expert Users

rsync - date/time stamp

Hi, We are using RSYNC for syncing remote directories and working great. Our requirement is to have the destination files with date/time stamp of when they're copied on to the destination server, NOT the date/time stamps of source files/directories. As RSYNC, by default, preserving the same... (4 Replies)
Discussion started by: prvnrk
4 Replies

10. Shell Programming and Scripting

Wrong date function

Hi, I am getting some very strange output when using date function in PERL on Solaris. Infact the month portion is wrong and it is 1 less then the current, means today it is responding as month =3 , andthis should be 4 ------> April Any help my code is ($day, $month, $year) =... (3 Replies)
Discussion started by: Asteroid
3 Replies
Login or Register to Ask a Question