I want to keep two directories in sync but with a slight difference, I want the 'destination' directory to have lower case names only. I.e. any file in the source directory that has an upper case name (or any upper case characters in its name) I want copied to the destination directory with a lower case name.
I guess I can come up with solutions that need me to write a wrapper script of some sort for rsync but I was wondering if anyone has any ideas for a ready made solution.
This needs to be run as a cron job by the way.
On 3 September 2010 20:38, Chris G cl@isbd.net wrote:
I want to keep two directories in sync but with a slight difference, I want the 'destination' directory to have lower case names only. I.e. any file in the source directory that has an upper case name (or any upper case characters in its name) I want copied to the destination directory with a lower case name.
And there'll never be a name clash with just a difference in case?
On Fri, Sep 03, 2010 at 08:44:01PM +0100, Tim Green wrote:
On 3 September 2010 20:38, Chris G cl@isbd.net wrote:
I want to keep two directories in sync but with a slight difference, I want the 'destination' directory to have lower case names only. I.e. any file in the source directory that has an upper case name (or any upper case characters in its name) I want copied to the destination directory with a lower case name.
And there'll never be a name clash with just a difference in case?
No, these are photo image files with formats like DSCF1234.JPG, I just happen to want a mirror directory of the same files with lower case names.
If there's a file DSCF1234.JPG and a dscf1234.jpg then they're almost certainly the same file. The source/parent directory will always have the originals anyway.
On 03/09/10 20:38, Chris G wrote:
I want to keep two directories in sync but with a slight difference, I want the 'destination' directory to have lower case names only. I.e. any file in the source directory that has an upper case name (or any upper case characters in its name) I want copied to the destination directory with a lower case name.
I guess I can come up with solutions that need me to write a wrapper script of some sort for rsync but I was wondering if anyone has any ideas for a ready made solution.
This needs to be run as a cron job by the way.
Can't you do this with rename ?
rename 'y/A-Z/a-z/' *
nev
On Sat, Sep 04, 2010 at 05:18:17AM +0100, nev young wrote:
On 03/09/10 20:38, Chris G wrote:
I want to keep two directories in sync but with a slight difference, I want the 'destination' directory to have lower case names only. I.e. any file in the source directory that has an upper case name (or any upper case characters in its name) I want copied to the destination directory with a lower case name.
I guess I can come up with solutions that need me to write a wrapper script of some sort for rsync but I was wondering if anyone has any ideas for a ready made solution.
This needs to be run as a cron job by the way.
Can't you do this with rename ?
rename 'y/A-Z/a-z/' *
Yes, but that stops rsync working. I want to synchronize a directory full of files with uppercase/mixed names with a directory having the same files with all lowercase names.
On 04/09/10 10:26, Chris G wrote:
Yes, but that stops rsync working. I want to synchronize a directory full of files with uppercase/mixed names with a directory having the same files with all lowercase names
I'm not sure I have quite understood the use case but have you looked at ciopfs? http://www.brain-dump.org/projects/ciopfs/
This is a FUSE-based file system that maps mixed case files to lower case and allows access to files on the filesystem in a case-insensitive way.
On Mon, Sep 06, 2010 at 09:53:02AM +0100, Mark Rogers wrote:
On 04/09/10 10:26, Chris G wrote:
Yes, but that stops rsync working. I want to synchronize a directory full of files with uppercase/mixed names with a directory having the same files with all lowercase names
I'm not sure I have quite understood the use case but have you looked at ciopfs? http://www.brain-dump.org/projects/ciopfs/
This is a FUSE-based file system that maps mixed case files to lower case and allows access to files on the filesystem in a case-insensitive way.
That might well do what I want, thanks for the pointer.
Hi,
On 6 September 2010 10:42, Chris G cl@isbd.net wrote:
On Mon, Sep 06, 2010 at 09:53:02AM +0100, Mark Rogers wrote:
On 04/09/10 10:26, Chris G wrote:
Yes, but that stops rsync working. I want to synchronize a directory full of files with uppercase/mixed names with a directory having the same files with all lowercase names
I'm not sure I have quite understood the use case but have you looked at ciopfs? http://www.brain-dump.org/projects/ciopfs/
This is a FUSE-based file system that maps mixed case files to lower case and allows access to files on the filesystem in a case-insensitive way.
I was composing a serious reply where I was writing that you should edit receiver.c in rsync (because, this kind of change should belong there, together with a command line option), but I fell off my chair in disgust at the sloppy code that comprises rsync.
I think you should give Mark's FUSE solution a go... it beats having to spend hours fixing up rsync [receive_data() or recv_files(), but probably the former, doing a tolower() on fname.... d'oh it's actually line 691, function recv_files() as I was originally writing, where fd2 is opened].
Good luck.
Srdjan