Jump to content

Recommended Posts

Posted

I want to backup and compress just one directory and all files inside it. Through cpanel I only have two choices, either backup everything or backup my entire homefolder.

 

Anyone know how I can backup just one folder? I tried playing with gzip and tar but not sure what command to run to make this happen.

 

Dennis

Posted

If this is just for every once in a while, you could ftp the directory to your computer and zip it up from there.

 

 

 

Or, if you want the server to do it, run the following commands with a cron job or whatever:

 

 

This archives all the files in the dir into one file, and compresses the new file:

>tar -czvf /home/user/output_filename.tgz /home/user/public_html/whatever_dir/

 

Notice the output file comes first, and the dir to be compressed is second in the command.

Posted

ahh, thats why it kept failing for me. Linux is so backwards :dance: or is it Windows is so backwards? hehe

 

Thanks Janda, your like my personal trainer on these forums.

 

Dennis

Posted

Great! I was looking for a solution to this. Just one question.

 

This error message appeared at the end of the email:

tar: Error exit delayed from previous errors Any idea what it means? The archive tested fine and when I unzipped it, the structure and files appeared to be fine also. I just don't understand why I got the error message.

Posted
This error message appeared at the end of the email:

tar: Error exit delayed from previous errors Any idea what it means?

What was your exact command?

 

Did you run this from a cronjob? If not, then where?

Posted

I got the same error. I ran from cron and also ran via php script. Both gave the same error. I assume it means one or more files it did not have access to. I have one file in on of my directories owned by root and it never appears in my backups. So I assume the error was from that.

 

Dennis

Posted
What was your exact command?

 

Did you run this from a cronjob?  If not, then where?

I must have notifications turned off and I haven't visited this forum since this post ... that's obvious.

Yes via a cron job, set to run only once. The command was:

>tar -czvfp /home/user/backup.tar.gz /home/user/public_html/gallery/

Posted

Nevermind about the "p" option. It is fine.

 

Anyway, you possibly have some files owned by "nodody" that are not readable by everybody. These were probably created by the gallery program. If your userid doesn't have access to at least read those files, then they cannot be backed up.

 

That's probably the case because Gallery does that to the data files for security purposes. You will need to either change the permissions on those files, or run the tar command under the user "nobody".

  • 2 months later...
Posted

Whats the difference between the TAR and GZIP commands? From what I'm understanding, gzip is to compress single or multiple mentioned files and TAR is to blanket a directory correct?

 

Please explain... Thanks

 

:)

 

Also, if I would run the above script via cron weekly, would it auto-overwrite the .tgz file?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...