[SOLVED] How to backup all files under a certain size?


Recommended Posts

I'd like to run through my movies directory recursively, and save every file that's under say, 2MB, to the cloud.  That way if I ever lose my entire server, I could build my media library back up quickly by just reripping/downloading ISOs and MKVs, and I'd have all my metadata that I've so painstakingly added safe.

 

Is there a way to do this?  Some kind of a script or something?

Link to comment

It's Java, and really easy. The one slightly weird part is tunneling the control application from your desktop to the server, but it isn't hard.

 

Once you get it going it becomes difficult to give up. Sooo nice to offload that function to an already running unRAID with almost endless storage.

Link to comment

Hmm, looks like that's not exactly what I'm looking for - I don't see the size filters anywhere, and I don't want a constantly running process - I'd rather do it manually.

find /mnt/user -type f -size -10k -exec ls -l {} \;

 

 

the

-size -NNN

will only print those files under the size specified. 

 

google

man find linux

to read more about it.

 

replace the "ls -l {}

with

cp {} /mnt/user/backup

or something similar...  (I don't think "cp" will create sub-folders)

Link to comment

Yea, I hadn't tried anything but name filters. Doesn't look like they've ever implemented size filters. I will say it's excellent software and requires minimal overhead on the server.

 

For what you're doing I'd be trying something like Joe. Copy or list the files you want and back that up. Something like:

  rsync -a --max-size=2k --prune-empty-dirs <source> <dest>

 

That'll put the files you want in <dest> where you can back them up however you like. Repeat before each backup and it will only copy changes.

 

A faster alternative might be cp -r -s ... so the copies are really just soft links. You're likely to end up with loads of empty directories if that's important.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.