Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How can I delete big files with rsync?

Off-Topic discussions about science, technology, and non Debian specific topics.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

How can I delete big files with rsync?

#1 Post by bester69 »

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:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: How can I delete big files with rsync?

#2 Post by bester69 »

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:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

cuckooflew
Posts: 677
Joined: 2018-05-10 19:34
Location: Some where out west
Been thanked: 1 time

Re: How can I delete big files with rsync?

#3 Post by cuckooflew »

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
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: How can I delete big files with rsync?

#4 Post by bester69 »

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:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

cuckooflew
Posts: 677
Joined: 2018-05-10 19:34
Location: Some where out west
Been thanked: 1 time

Re: How can I delete big files with rsync?

#5 Post by cuckooflew »

Well if it works, that is what counts
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: How can I delete big files with rsync?

#6 Post by bester69 »

cuckooflew wrote:Well if it works, that is what counts
I always win, thats what it counts 8)
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

Post Reply