# Sync Local Folder via FTP

It’s easy to automatically [upload files](/help/file-upload/upload-images/) from a local folder to your Sirv account, via FTP (files listed in a spreadsheet can be [uploaded from a CSV](/help/file-upload/bulk-upload-images-csv/), and files in a code repository with [GitHub Actions](/help/integrations/upload-images-to-sirv-with-github-actions/)). Follow the instructions below.

## Get your FTP credentials

First, get your FTP login details from your [Uploads settings](https://app.sirv.com/settings/uploads) page. If your user belongs to multiple accounts, make sure not to omit the “+account” part from the login.

![FTP server, user and password in the Uploads settings](https://docs.sirv.com/img/help/screenshots/app-2026-11/uploads-ftp-login.png)

 Then follow the instructions below, depending on whether you use Windows, Linux or Mac.

## Sync files from Windows

### 1\. Get WinSCP

WinSCP ([download](https://winscp.net/eng/download.php)) is a powerful free program that can sync local folders via FTP. To sync your local folder with Sirv, open WinSCP and follow these steps:

### 2\. Connect to FTP

After launching WinSCP, you’ll be greeted with the login screen:

![WinSCP ftp login screen](https://sirv.sirv.com/website/screenshots/Help-Center/ftp-sync/login.png?profile=screenshots-grey-border)

Enter your credentials from [Uploads settings](https://app.sirv.com/settings/uploads). Set the file protocol to FTP, encryption to ‘no encryption’ and port to 21. Save your session for future convenience.

### 3\. Open the remote directory sync tool

Click “Commands” > “Keep remote directory up to date”.

![Keep remote directory up to date - menu](https://sirv.sirv.com/website/screenshots/Help-Center/ftp-sync/remote-directory.png?profile=screenshots-grey-border)

### 4\. Start syncing

Select the local folder and the folder in your Sirv account.

You can open your local folder on the left pane of WinSCP and your remote folder on the right pane, these settings will be automatically populated.

![Keep remote directory up to date - screenshot of window](https://sirv.sirv.com/website/screenshots/Help-Center/ftp-sync/remote-up-to-date.png?profile=screenshots-grey-border)

If you’d like to mirror your local folder to your Sirv folder, click the ‘Delete files’ checkbox. This will delete files from Sirv, if they’ve been deleted from your local folder.

Sync will start immediately and should keep running until you restart Windows. Minimize the window to the system tray, to keep it out of the way.

### Delete or move file after upload

Once a file has been uploaded, Sirv can sort it for you with [folder automation rules](/help/file-upload/folder-automation-rules/). Most Sirv users also want to either delete the local file or move it to another folder for long term local storage. This can be done with a WinSCP script.

Documentation is here:

-   [Delete local file after upload - WinSCP](https://winscp.net/eng/docs/faq_delete_synchronized_files)
-   [Move local file after upload - WinSCP](https://winscp.net/eng/docs/script_local_move_after_successful_upload)

If you’re not proficient in scripting, but would like to implement this workflow, follow these steps:

1.  Open WinSCP and connect to Sirv FTP.
2.  On the right pane, go to the desired sync folder.
3.  On the left pane, select the folder and click Files > Upload > Upload and Delete:

![WinSCP screenshot, upload and delete files](https://sirv.sirv.com/website/screenshots/Help-Center/ftp-sync/WinSCP-1-upload-delete.png?profile=screenshots-grey-border)

4.  In Transfer settings, click Generate Code:

![WinSCP screenshot, generate code](https://sirv.sirv.com/website/screenshots/Help-Center/ftp-sync/WinSCP-2-generate-code.png?profile=screenshots-grey-border)

5.  Copy the script and save it somewhere as a .txt file. It’ll look similar to this:

```sh
    open ftp://yourname%40yourdomain.com%2Btesting:yourpassword@ftp.sirv.com/

    lcd C:\\
    cd /sync

    put -delete YourLocalFolder\\*

    exit

    # Execute the script using a command like:
    # "C:\\\Program Files (x86)\\\WinSCP\\\WinSCP.exe" /log="C:\\\logs\\\WinSCP.log" /ini=nul /script="C:\\\Users\\\david\\\Desktop\\\sirvsync.txt"
```

To prevent WinSCP from deleting the source folder, add a backslash with an asterisk to the end of line 4.

For example, change this: put -delete YourlocalFolder to this: put -delete YourlocalFolder\\\*

6.  Open Windows Task Scheduler and create a new task. Configure the scheduling trigger however you wish:

![WinSCP screenshot, edit trigger](https://sirv.sirv.com/website/screenshots/Help-Center/ftp-sync/edit-trigger.png?profile=screenshots-grey-border)

7.  In the Actions section, choose “Start Program” and enter the path to your WinSCP execution file. Usually, it is: “C:\\Program Files (x86)\\WinSCP\\WinSCP.exe”.
    
    In the Arguments section, add the location of your log file (you need to create it beforehand), for example: /log=“C:\\logs\\WinSCP.log”.
    
    Follow it with /ini=nul and the location of your script file, for example: /script=“C:\\Users\\david\\Desktop\\sirvsync.txt”.
    
    The full line will look something like this: /log=“C:\\logs\\WinSCP.log” /ini=nul /script=“C:\\Users\\david\\Desktop\\sirvsync.txt”
    
8.  Save your changes and you’ve finished:
    

![WinSCP screenshot, run program](https://sirv.sirv.com/website/screenshots/Help-Center/ftp-sync/edit-action.png?profile=screenshots-grey-border)

## Sync files from macOS/Linux

Syncing a local folder to Sirv via FTP can be done either with [CyberDuck](https://docs.cyberduck.io/cyberduck/sync/) or a simple script that uses the tool called LFTP.

### 1\. Get LFTP

Use your system’s package manager to install LFTP. To install LFTP on Ubuntu, use this command:

```bash
sudo apt install lftp
```

To install LFTP on macOS, you can use [Homebrew](https://brew.sh):

```bash
brew install lftp
```

### 2\. Create the script

Create a file named sync.sh with the following contents:

```sh
#!/bin/bash
HOST='ftp.sirv.com'
USER='YourUsernameHere'
PASS='YourPasswordHere'
TARGETFOLDER='/Your-Remote/Folder/Here'
SOURCEFOLDER='/home/user/localfolder'

lftp -f "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror -R --scan-all-first --only-newer --verbose $SOURCEFOLDER $TARGETFOLDER --no-perms
bye
"
```

### 3\. Configure the script

Change these parameters in the script file:

-   YourUsernameHere - your username from your [Uploads settings](https://app.sirv.com/settings/uploads)
-   YourPasswordHere - the password you use to login to Sirv
-   /Your-Remote/Folder/Here - path to the folder in your Sirv account
-   /home/user/localfolder - path to your local folder

LFTP’s mirror has plenty of options that allow you to delete source files (—Remove-source-dirs), upload only newer files (—only-newer) and many more ([full list of LFTP options](https://gist.github.com/IgorVaryvoda/f2fbbc825b6af38ac4e8ae2c1c3469e8)).

### 4\. Make it executable

Make the script executable, like so:

```bash
chmod +x sync.sh
```

### 5\. Test the script

Run the script, to check if it’s working:

```bash
./sync.sh
```

### 6\. Schedule script execution

Scheduling the script can be done via Crontab. If you’re not familiar with Crontab expressions, you can generate the command with [Crontab Generator](https://crontab-generator.org/).

Then run crontab -e and paste your expression at the end of the file. Here’s an example:

```bash
*/5 * * * * /home/user/sync.sh >/dev/null 2>&1
```

This will run your script every 5 minutes. Make sure to set the correct path to the sync.sh file.
