[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a script to just back up files in a folder



I assume you are writing a script, and that you want that script to back up only the files in your home directory (but no subdirectories, and no files inside those subdirectories).

One way to do that might be:

rm -f /tmp/home-files.txt
find ~ -maxdepth 1 -type f -print >> /tmp/home-files.txt
tarsnap --dry-run -v -cf "homefiles_$(date +%Y-%m%d)" \
    --files-from /tmp/home-files.txt

Those three commands will show you what files tarsnap would save, and how much space would be used when backing up those files.  If you're happy with how that looks, you'd need to drop the '--dry-run' so that tarsnap would actually save the files.  And at some point you would probably want to drop the '-v' too, so that tarsnap won't print out the full list of the files it is saving each time you run the script.

	-- garance alistair drosehn
	-- senior systems programmer


> On Jun 8, 2016, at 7:53 PM, Sarah Alawami <marrie12@gmail.com> wrote:
> 
> Hello to all. I set up my scripts for my home folder to back up only what I want. Is there a way though to back up only the files at my root ~ directory? Can I create a script that just backs up the files that should go in the root or what do I need to do in this case? Not everything in my ~ directory is in a folder so wanted to know what would be the best way of going about this.
> 
> Thanks all and be blessed.