Question:
I have been trying to back up a website with say, 2000 files on it. The ftp connection drops from time to time but my program (Cuteftp) can auto-resume. However I am not convinced I've backed up all files - what I'm looking for is a way of counting the files on the site (I don't control the server, just have a basic PHP Admin panel access) to check, or better, are there any programs out there that can back up via ftp to one's PC in a verifiable way and even only copy files that are newer or added on the Website?
Answers:
wget at
Answers:
write a php script to count the files
Answers:
The Windows GUI version of Wget looks ideal for my needs. Reading the manual, the only thing I'm not sure about is whether it follows links to decide what to download or whether it does a directory lookup on the hosting server like an ftp program would do. If via links, then it would try to download all the php generated dynamic content which would not be good news!
Brilliant piece of advice Benway, I will be trying this program out.
Answers:
The Windows GUI version of Wget looks ideal for my needs. Reading the manual, the only thing I'm not sure about is whether it follows links to decide what to download or whether it does a directory lookup on the hosting server like an ftp program would do. If via links, then it would try to download all the php generated dynamic content which would not be good news!
Brilliant piece of advice Benway, I will be trying this program out.
You miss the point of wget. Wget is an all rounder.
It doesn't just talk http it talks ftp as well. See:
Never used wget gui only cli so cant comment on that.
I would also check what access you have to the webserver. If you have shell access and it is running some version of GNU/Linux then there are many different approaches you can take.
P.S. if you have any mysql data (or similar), dont forget to back that up as well.
A backup is for life not just ...
Answers:
A simple idea may be to compare the folder size of the web site and the backup version. If they are them same size you have copied all the files accross.
Dan
Answers:
A simple idea may be to compare the folder size of the web site and the backup version. If they are them same size you have copied all the files accross.
Dan
This idea will not necessarily work. For instance the size of a directory on Linux
when copied file by file to another location is not always the same. Ideally you should copy the files one by and check the exit codes of the copy or do diffs on the file (which may not work if you are ftp in ascii mode).
All O/Ss have there little discrepencies. Just look at the properties of a file in windows explorer. Is the file size the "Size: 485KB" or the "469,550 bytes" right next to it. Or is it the "Size on disk: 460KB" or the "471,040 bytes" right next to that. And the original was none of the above because of the ascii conversion mentioned above.
Answers:
Yes I agree. However I have only PHPAdmin Panel access to the site, not full control. So how do I get the site size and/or the number of files?
Answers:
Can you not use cuteftp to give you the info ?
Answers:
Looked around all the obvious Cuteftp options - no method there, it only counts 1 level down from a dir.
Answers:
I could see that Wget has loads of functionality & that I will have to invest some time in learning how to use it - in ftp mode which would suit the purpose of backing up PHP scripts.
About comparing file sizes - actually, a simple count comparison would do for an initial backup. I have only the most basic phpMyAdmin panel access, have yet to work out if there's an ftp commnad to count all the files in all directories.
The DB is not really an issue - it backs up fast using the MySQL control panel and I can check the result.
Answers:
Do you have shell (command prompt) access to your webhost? If so, and it's *nix based, use tar to bundle all your files and directories into one big file. Then just copy that to your backup location. This method also makes restoring the data much easier.
If you're in the root (top) folder of your webspace, you can use the following command:
tar zcvf backup_file.tar.gz *
I'd also second DrBenways' comment about backing up any data stored in databases etc. For MySQL, look at the mysqldump command.
Another possibility is that some web hosting control panels (e.g. cPanel, Plesk) have a backup utility.
Answers:
No I raised this question becuase I do not have command prompt access and the Panel is very basic - no backup option. Ftp programs can do a backup of sorts but I need a way to verify that all files came across and later, a way of backing up only newer files.
Wget as suggested by Benway looks very promising, when I can get my head around it!
Answers:
I see. Looking at it from another perspective, are there any files on your site that change dynamically? (i.e. users' upload them, files are generated by scripts).
If not (i.e. your website is only updated when you FTP stuff across) then backing up the stuff on your webhost isn't worth it. Instead, just keep a backup of the files already located on your PC.
Answers:
Help with wget.
I am assuming you are using windows here.
Sit in an empty directory and do:
wget --mirror -o logfile.txt
Where username and password are the login details to the ftp site.
ftp.yoursite.com is the ftp site you login into.
logfile.txt will contain a listing of what wget tried to do.
You may need to add a path to wget like "c:\Program Files\wget\wget" instead of just wget if you didn't add the location of wget.exe to your PATH variable.
You can fine tune the options at your leisure but that will get you a copy of the ftp site.
Answers:
Whoops. Forgot to disable smilies. Command is:
wget --mirror -o logfile.txt
Answers:
Whoops. Forgot to disable smilies. Command is:
wget --mirror -o logfile.txt
This is getting very close to what I need - I noticed the Mirror bit in the Wget documentation. There's an additional parameter to play with after the first mirror is created, which can copy down only newer files, which will save a lot of downloading (there is a bit of dynamic content in that if in our online store, new products get added, then new images are imported into the site).
Update: A bit of research and it looks like if I add -S as the 1st argument to the above command the first time I run it, then a -N the 2nd time, on the 2nd run it will only pick up newer files. Will be installing Wget to try this very soon...
Answers:
--mirror takes care of downloading only changed files.
From the wget docos:
--mirror
Turn on options suitable for mirroring. This option turns on recursion and time-stamping, sets infinite recursion depth and keeps ftp directory listings. It is currently equivalent to -r -N -l inf --no-remove-listing.
You might want to check what happens if you mirror the site after image files have been removed. Does it remove them from the local mirror ? Or leave them in ?
Answers:
As for the counting of files you have. Why not write a php script to do it. You can probably find one on the web if you look. The php functions opendir, closedir, readdir, stat and lstat are your friends here.
Answers:
OK, installing it, found a precompiled version of Wget & installed it but getting error "packet driver not found". This will be working real soon now...
