2011.12.27

FTP protip: move files instead of deleting

Lately I’ve been favoring SSH to upload/delete files from a server since it’s faster and I feel it gives me more control/power, but I still use a regular FTP client for most of my daily use (since I don’t have SSH access to all servers), this is just a very basic tip that some people may not be aware of and that can boost productivity and reduce downtime during updates.

The Workflow

  1. Upload new files to a _swap directory.
  2. Move current files to a _backup directory.
  3. Move new files from _swap to the parent directory.
  4. Test live files.
  5. Delete files inside the _backup directory.
  6. Win one free internet.

Why?

The main reason is because moving files on FTP is way faster than deleting them, specially if you are moving the files to a parent directory, it can reduce the downtime from a couple minutes to a few seconds depending on how many files you are updating.

Another reason is that you will have a backup of the current files on the server and you can easily revert the changes in case anything goes wrong. - You should also keep all source files on a version control system and make updates when the site has as few users as possible (usually from 9pm to 9am) to reduce the chance of ruining everything…

That’s it!


Comments

Leave a Comment

Please post only comments that will add value to the content of this page. Please read the about page to understand the objective of this blog and the way I think about it. Thanks.

Comments are parsed as Markdown and you can use basic HTML tags (a, blockquote, cite, code, del, em, strong) but some code may be striped if not escaped (specially PHP and HTML tags that aren't on the list). Line and paragraph breaks automatic. Code blocks should be indented with 4 spaces.