From the course: Learning Static Site Building with Jekyll

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Remove old files from the server

Remove old files from the server

From the course: Learning Static Site Building with Jekyll

Start my 1-month free trial

Remove old files from the server

- [Instructor] In most cases, you'll want to remove or clean out your old site files before uploading newly generated files. Without this step, anything you delete on the Jekyll side will stay on your server until you manually delete it. If you only plan on adding content and never removing anything, you could skip this step. I'm going to add some code to the clean remote method. What I'll do is, I'm going to need to call the sftp client to list the files that are currently on the server so I'll do return sftp.list. We'll tell it to list the remote path base, essentially the public html folder and then after that we'll do then. We'll get back a list of objects and we want to act on those objects. So, we'll say object list to a new block of code. There are a few items we'll want to always ignore so let's filter those out. Let's say object list equals objectlist.filter and anything that is not part of something we'll call, ignoredremoteitems.hasobj.name. That'll match against anything…

Contents