[Solved] rsync --delete --max-size??

Programming languages, Coding, executables, and scripting.
Post Reply
Message
Author
User avatar
bester69
Posts: 1964
Joined: 2015-04-02 13:15
Has thanked: 13 times
Been thanked: 5 times

[Solved] rsync --delete --max-size??

#1 Post by bester69 »

Hi,

Do you know How do i get this:
rsync --delete --max-size=20M /source /target

this, only works once.. when i update max-size, delete option doesnt purge target files bigger or smaller than "max-size"...
Its very strange, it obligates me to delete all target files before i want to sync filtering by size file in order to work properly :shock: ..

Right now, I have it this way working like I would like it..(I had to use hardlinks to prevent all files being copying each time, cos I need a first delete.)

Code: Select all

rm -R "$pathvideoshort/"*
rsync -av --delete --max-size=12M --link-dest="$pathvideos/" "$pathvideos/" "$pathvideoshort/"


Thanks a lot.
Last edited by bester69 on 2020-12-04 00:51, edited 1 time in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...

sgosnell
Posts: 975
Joined: 2011-03-14 01:49

Re: rsync --delete --max-size??

#2 Post by sgosnell »

Do you believe that --delete affects --max-size? Please read, and try to understand, the fine rsync manual.

Code: Select all

man rsync
Take my advice, I'm not using it.

User avatar
bester69
Posts: 1964
Joined: 2015-04-02 13:15
Has thanked: 13 times
Been thanked: 5 times

Re: rsync --delete --max-size??

#3 Post by bester69 »

sgosnell wrote:Do you believe that --delete affects --max-size? Please read, and try to understand, the fine rsync manual.

Code: Select all

man rsync
Ok, i understand.. then we could do following thing.:

Solution Proposed (filtering bigger filesize)
find "$pathvideoshort/" -type f -size "+$size" -exec rm "{}" \;
rsync -av --delete --max-size="$size" "$pathvideos/" "$pathvideoshort/"

Solution Proposed (filtering lower filesize)
find "$pathvideoshort/" -type f -size "-$size" -exec rm "{}" \;
rsync -av --delete --min-size="$size" "$pathvideos/" "$pathvideoshort/"


It was something not easy to view at first look..firt time I gave into this issue.. :shock: :?
bester69 wrote:You wont change my mind when I know Im right, Im not an ...

sgosnell
Posts: 975
Joined: 2011-03-14 01:49

Re: [Solved] rsync --delete --max-size??

#4 Post by sgosnell »

Why do you care about the file size? Exactly what problem are you trying to solve?
Take my advice, I'm not using it.

User avatar
bester69
Posts: 1964
Joined: 2015-04-02 13:15
Has thanked: 13 times
Been thanked: 5 times

Re: [Solved] rsync --delete --max-size??

#5 Post by bester69 »

sgosnell wrote:Why do you care about the file size? Exactly what problem are you trying to solve?
I wanted to exclude big files vids from my daily borg backup repository...
bester69 wrote:You wont change my mind when I know Im right, Im not an ...

sgosnell
Posts: 975
Joined: 2011-03-14 01:49

Re: [Solved] rsync --delete --max-size??

#6 Post by sgosnell »

Then just use max-size. You don't need delete.
Take my advice, I'm not using it.

Post Reply