LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 08-25-2010, 02:02 PM   #1
dormant
LQ Newbie
 
Registered: May 2003
Posts: 18

Rep: Reputation: 0
rsync with changing directory structure


I've been using rsync in a bash script to make hourly copies of jpeg files that are created every few minutes. The images are contained in a number of subdirectories, with the filenames using the date and time

Quote:
data/images/GARI/GARI_20100825_135403.jpg
data/images/GARI/GARI_20100825_135903.jpg
data/images/FRED/FRED_20100825_135407.jpg
At the moment, my source and target directories are identical, and rsync is easy:

Quote:
rsync -av data/images/ /mnt/data/images
Note that the source directory is purged at regular intervals to stop it filling up. So the target directory has all the images, but the source doesn't.

I need to change my script so that the target directory has a different structure from the source directory, like this:

Quote:
/mnt/data/images/GARI/2010/2010-08/GARI_20100825_135403.jpg
/mnt/data/images/GARI/2010/2010-08/GARI_20100825_135903.jpg
/mnt/data/images/FRED/2010/2010-08/FRED_20100825_135407.jpg
Is there any way I can do this with rsync in a bash script?
 
Old 08-26-2010, 02:33 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
A few questions:

Do you think that /2010/2010-08/ is technically necessary?
Will the source directories ever have dates that roll over
a "date break" (for want of a better word)? I.e.,
Code:
data/images/GARI/GARI_20100831_235903.jpg
data/images/GARI/GARI_20100901_000403.jpg
 
Old 08-26-2010, 03:44 PM   #3
dormant
LQ Newbie
 
Registered: May 2003
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
Do you think that /2010/2010-08/ is technically necessary?
Totally unnecessary. Stupid, even.

I am doing this for a colleague who has already created the directory structure and cannot be persuaded to change it.
 
Old 08-26-2010, 04:51 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
What about question 2)? That's more relevant to helping
you with a technical solution.
 
Old 08-27-2010, 10:49 AM   #5
dormant
LQ Newbie
 
Registered: May 2003
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
What about question 2)? That's more relevant to helping
you with a technical solution.
Sorry.

Yes the source directories will contain images with dates that roll over.

The images are being produced in real-time by cameras that takes one photo every few minutes. The source directory will always contain the last n days of images (n is 30 at the moment). I am trying to use rsync to move these to their permanent storage.
 
Old 08-27-2010, 04:50 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
If they roll over months you won't be able to shuffle them
with rsync?
 
Old 08-28-2010, 04:32 PM   #7
dormant
LQ Newbie
 
Registered: May 2003
Posts: 18

Original Poster
Rep: Reputation: 0
Looks like I'll have to do a Perl script then.

Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Convert directory structure from long file names in Linux to DOS 8.3 structure? manorina Linux - Software 5 09-12-2009 10:18 AM
Home Jail Folder Structure like Gobolinux Directory Structure luispt Linux - General 3 07-26-2008 07:46 PM
Changing permissions of destination directory after rsync cliff123 Linux - General 1 12-26-2007 04:09 AM
RSYNC Directory Structure? carlosinfl Linux - General 2 09-18-2007 02:58 PM
"WARNING: Circular directory structure" error when deleting directory pistonbrew Linux - Software 5 02-03-2005 07:05 AM


All times are GMT -5. The time now is 02:49 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration