---
title: Using BackupPC to archive backups via SFTP
kind: blog
description: Here's a little wrapper script I wrote to let BackupPC archive onto a SFTP server.
words: 31
readingMinutes: 1
created: '2013-12-29T16:20:55.000Z'
updated: '2026-06-27T21:03:45+02:00'
tags:
  - backuppc
  - remote
  - system-administration
---
```shell
#!/usr/bin/env csh  
# Create temporary directory  
mkdir -p /tmp/backuppc-archive  
  
# Clean previous archive, if any  
rm "/tmp/backuppc-archive/$4.$5.tar$7"  
  
# Call BackupPC_archiveHost  
BackupPC_archiveHost "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "/tmp/backuppc-archive" "${10}" "${11}"  
  
# Copy to SFTP  
scp "/tmp/backuppc-archive/$4.$5.tar$7" user@host:/  
  
# Remove temporary archive  
rm "/tmp/backuppc-archive/$4.$5.tar$7"
```

To use this, save the script, set its executable flag, and configure BackupPC to use it instead of the default script - either in the global _config.pl_ or a client-specific config:  
  
```perl
$Conf{ArchiveClientCmd} = '/path/to/script/above.sh $tarCreatePath $splitpath $parpath $host $backupnumber $compression $compext $splitsize $archiveloc $parfile *';
```
