How can I delete big files with rsync?

If it doesn't relate to Debian, but you still want to share it, please do it here

How can I delete big files with rsync?

Postby bester69 » 2020-06-17 06:41

Hi,
I would like to remove in one instruction a folder by using filter size umbral.., how can i don this with rsync or find?

I'd like something like this, but I dont find the way: :roll:
:idea: rsync -av --delete --max-size=60M Movies/ Movies/



Any idea, thanks a lot.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: How can I delete big files with rsync?

Postby bester69 » 2020-06-17 07:22

Perhaps I could do someting like this.:

cp -alvr Movies/* AllMovies/
cp -alvr Movies/* BigMovies/ && find BigMovies/ -type f -size -60M -exec rm {} \;
cp -alvr Movies/* SmallMovies/ && find BigMovies/ -type f -size +60M -exec rm {} \;

rsync -av --delete SmallMovies/ Movies/ (filter by small size movies)
or
rsync -av --delete BigMovies/ Movies/ (filter by big size movies)

:o
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: How can I delete big files with rsync?

Postby cuckooflew » 2020-06-17 11:51

Some search foo maybe : used these key words:
Code: Select all
How to remove or delete files when using rsync


UPDATE

As I find that the delete options are just for TARGET that if some files are removed from source, rsync --delete remove them from TARGET. And the delete option by after and before, as mentioned in its man page:

--delete-before receiver deletes before transfer, not during

Means that:

rsync delete the file from TARGET which are removed from SOURCE.
rsync start syncing files.

--delete-after receiver deletes after transfer, not during

Means that:

rsync start syncing files.
rsync delete the file from TARGET which are removed from SOURCE after syncing.

NOTE: The --delete-{before/after} implement just in TARGET.

Also
Code: Select all
man rsync
is a very use full command. But off hand I don't know exactly cause I don't exactly understand what you want to do.
I use this :
Code: Select all
rsync [options] SOURCE TARGET
find TARGET -maxdepth 1 -type f -mtime +60 -exec rm -f {} \;

Sometimes...
Please Read.. What we expect you have already Done.
Does any one know about this ?
Users browsing this forum: Google Knows, and
My grand father knows all about everything:
…one flew east, one flew west,
One flew over the cuckoo’s nest.
cuckooflew
 
Posts: 388
Joined: 2018-05-10 19:34
Location: Some where out west

Re: How can I delete big files with rsync?

Postby bester69 » 2020-06-17 14:56

cuckooflew wrote:..
rsync start syncing files.
rsync delete the file from TARGET which are removed from SOURCE after syncing.

NOTE: The --delete-{before/after} implement just in TARGET.
Also
Code: Select all
man rsync
is a very use full command. But off hand I don't know exactly cause I don't exactly understand what you want to do.
I use this :
Code: Select all
rsync [options] SOURCE TARGET
find TARGET -maxdepth 1 -type f -mtime +60 -exec rm -f {} \;

Sometimes...

Hi, Thanka for answering (we're talking about filtering by size not time :!: )

I wanted to make free local disk space for my MEGA movies folder collection... So ,I wanted to keep smaller movies than 40Mbytes and rest of them keep them in server side in a renamed folder VIDS_SERVER...

So, I wanted a rsync --delete with that keeps lower files han 40M for client side folder, and the opposite to rename in side server and take away from syncing in server MEGA side.

I was trying to rsync agains same folder for just applying max-size filter and purge filer bigger than XX size, the idea was this, but i dont know if it can be make it in just one step:

RSYNC --DELETE --MIN-SIZE=50M TARGET/ TARGET/

but using my purposed soltion and working with hardlinks made it : :o
Smallmoves goes to clien side
Bigmovies goes to server side (outisde sync)


cp -alvr Movies/* AllMovies/
cp -alvr Movies/* BigMovies/ && find BigMovies/ -type f -size -60M -exec rm {} \;
cp -alvr Movies/* SmallMovies/ && find BigMovies/ -type f -size +60M -exec rm {} \;

rsync -av --delete SmallMovies/ Movies/ (filter by small size movies)
or
rsync -av --delete BigMovies/ Movies/ (filter by big size movies)
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: How can I delete big files with rsync?

Postby cuckooflew » 2020-06-17 15:14

Well if it works, that is what counts
Please Read.. What we expect you have already Done.
Does any one know about this ?
Users browsing this forum: Google Knows, and
My grand father knows all about everything:
…one flew east, one flew west,
One flew over the cuckoo’s nest.
cuckooflew
 
Posts: 388
Joined: 2018-05-10 19:34
Location: Some where out west

Re: How can I delete big files with rsync?

Postby bester69 » 2020-06-17 17:36

cuckooflew wrote:Well if it works, that is what counts

I always win, thats what it counts 8)
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15


Return to Offtopic

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable