Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: rsync and [0-9]

In comp.os.linux.advocacy, Roy Schestowitz
<newsgroups@xxxxxxxxxxxxxxx>
 wrote
on Thu, 12 Oct 2006 23:01:56 +0100
<2594855.TY2ATiOYUg@xxxxxxxxxxxxxxx>:
> __/ [ amit ] on Thursday 12 October 2006 22:17 \__
>
>> Hello Group,
>> 
>> 
>> How can I make rsync in this command?
>> 
>> rsync -z -perms --progress --stats -b --backup-dir=/Thursday -a -r
>> /usr/local/ldb/db/[0-9]/aDir
>> /root/backups/Thursday/ldb/db/[0-9]/aDir
>> 
>> 
>> where [0-9] stands for directories with numeric names.
>> 
>> 
>> Thanks in advnce.
>> Amit
>
> Hi,
>
> Try something like this.
>
> for file in find /usr/local/ldb/db/ -maxdepth 1 | grep [0123456789]

Problematic: try

find /usr/local/ldb/db -name '.*[0-9][0-9]*.*' -maxdepth 1 | while read file

or

find /usr/local/ldb/db -name '[0-9]*' -maxdepth 1 | while read file

or

find /usr/local/ldb/db -name '[0-9]' -maxdepth 1 | while read file

depending on whether one wants filenames containing digits, or filenames
with *only* digits, or filenames consisting of a single digit.

The main problem with your suggestion, apart from
forgetting the backquotes, is that, if there's a large
number of files one might get a 'too many arguments'
diagnostic from the shell.  For small lists, however,
it might work well enough.


>  do
> rsync -z -perms --progress --stats -b --backup-dir=/Thursday -a -r ${file}
> /root/backups/Thursday/ldb/db/
> done

The rest of it looks reasonably good, pending my verification of the
'-z' argument.

>
> You'll probably need to polish this because it's not tested and done in a
> rush.
>
> Hope it helps,

Indeed. :-)

>
> Roy
>


-- 
#191, ewill3@xxxxxxxxxxxxx
Linux.  Because Windows' Blue Screen Of Death is just
way too frightening to novice users.

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index