Automated FTP Downloading

matt3m

Cadet
Joined
Jan 20, 2022
Messages
5
Hi,

I am thinking of building a new Plex NAS and contemplating using TrueNAS instead of Windows 10 (which I am currently using).

What I would like to know is if it's possible to download a file from a server and then once downloaded the file is deleted from the server. I currently use WinSCP with a script that is something like this

Code:
option batch abort
option confirm off
open sftp://user:host -hostkey="ssh-rsa SSH KEY= USER"
get -delete "/media/drivelocation/*" "G:\Folder\"


I then have Windows run that script every hour to check for something new.

Is there anything like this on TrueNAS?

Please bear in mind that I am a complete noob and have never used TrueNAS or any sort of Linux software and also haven't installed TrueNAS yet as I haven't purchased the parts yet. I also had a lot of help setting up the Windows script so something that is user friendly would be best for me and help me decide if I should use TrueNAS or stick with Windows.

Thanks for your help/advice in advance :)
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
It’s eminently doable, it’s a pretty simple use case, if something of a slightly odd one.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
You might first want to look at cloud sync tasks.

You may be able to couple that with another script to make any other changes needed, but I think it may already be enough for what you mentioned.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Worst case, the equivalent shell script should be pretty simple. Something like:
Code:
sftp --get remoteServer/remote/path/*
sftp --delete remoteServer/remote/path/*


That’s just pseudocode, of course, the details are left as an exercise to the reader and man sftp is your friend.
 

matt3m

Cadet
Joined
Jan 20, 2022
Messages
5
You might first want to look at cloud sync tasks.

You may be able to couple that with another script to make any other changes needed, but I think it may already be enough for what you mentioned.

I had a look at Cloud Sync Tasks and the Move function looks like it could be what I'm after. Although I'm not sure if my FTP provider is supported.

Worst case, the equivalent shell script should be pretty simple. Something like:
Code:
sftp --get remoteServer/remote/path/*
sftp --delete remoteServer/remote/path/*


That’s just pseudocode, of course, the details are left as an exercise to the reader and man sftp is your friend.

Interesting, that is pretty similar to what I'm using at the moment on Windows. Can that be setup to run on a cron job and is there any documentation on how to set it all up with TrueNAS?

Thanks :)
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Although I'm not sure if my FTP provider is supported.
if it's FTP or SFTP (SSH), it should be fine... give it a try in any case. (System | Cloud Credentials is where to look)
 

matt3m

Cadet
Joined
Jan 20, 2022
Messages
5
if it's FTP or SFTP (SSH), it should be fine... give it a try in any case. (System | Cloud Credentials is where to look)
Oh great! I haven't purchased the parts so will have to try it when I have purchased and assembled the computer.

It sounds like it could be what I'm after though :smile:

Thanks for the help/advice.
 
Top