# Script to automate file transfer from my seed box to my local drive



## Knight2A4 (Mar 9, 2016)

Hello Everyone,


I would require some help in writing a script to Automatically Backup files some remote sever to local drive over ftp. O.K am a mech. And being trying to find a way to automate file transfer from my seed box to my local drive. By googling I reached to this article how to automatically backup your web server files with winscp over ftp but its been down hill from there on as my knowledge of programming is almost nil. And the author of the article did not mention where to insert the script or how it will be used. He provided link to winscp site. I have been banging my head for two days now trying to understand how open & get command works in a script to make winscp log in the remote server n download required files automatically. Finally decided that I require help from people who know scripting that brought me here. Now if you could help me out here. My objectives are 1. winscp should login to the ftp server  with login: anonymous & password: (nil, no password) at a given time ex: 11.00 pm or at the start of the pc as shown in the article 2. should look into a pre-specified folder in the seed box for any new file generated  3.  compares it to pre-specified folder on local storage 3. download any new file that it finds in the seed box 4. writes all these activity in a log file and places it on a specific location as shown in the article. Optionally if you can 5. after completion of task asks for shut down. If does not get any answer in a particular time interwell executes shut down.      


Thanks in advance for any help & any advice towards the topic is welcome.


----------



## a_k_s_h_a_y (Mar 9, 2016)

you can create your own program using AutoIT, programming required.
else find tool which has this sync functionality  
else on linux, mac its too easy with rsync.


----------



## Desmond (Mar 9, 2016)

What are you using for a seedbox? Also, what OS are you running on your local machine?


----------



## Knight2A4 (Mar 10, 2016)

@ a_k_s_h_a_y thanks for the tip. but the tool you are suggesting requires additional programming skills that i do not have nor the time to learn languages or VB 
 [MENTION=5007]Desmond David[/MENTION] Its an old android phone. OS is win 10. My description of seedbox is not that of high speed with VPN service. Its more over like continuously downloading n seeding platform.


----------



## Zangetsu (Mar 10, 2016)

use Wget for Windows.

Wget for Windows

it doesn't require programming skills and simple to use.


----------



## Desmond (Mar 12, 2016)

Hakimtai said:


> @ a_k_s_h_a_y thanks for the tip. but the tool you are suggesting requires additional programming skills that i do not have nor the time to learn languages or VB
> [MENTION=5007]Desmond David[/MENTION] Its an old android phone. OS is win 10. My description of seedbox is not that of high speed with VPN service. Its more over like continuously downloading n seeding platform.



Therefore, if my understanding is correct, you are running a torrent client on your phone and you want to periodically retrieve the files from your phone to your PC? If you phone is connected to your PC via cable, then its only a matter of syncing some folder on your PC with the torrent folder on your phone. One tool I know that can accomplish this is SyncToy, you can get it here: Download SyncToy 2.1 from Official Microsoft Download Cente. There might be better utilities but this is the only one I can think of right now.

If you want to transfer data wirelessly, then its a bit more tricky. However, there might be apps and utilities that might allow you to periodically sync data from your phone. But I don't know any at the moment since I have never needed to do that yet.


----------



## Knight2A4 (Mar 12, 2016)

[MENTION=5007]Desmond David[/MENTION]  Ya that’s correct. o.k let me explain it I had an old android phone HTC explorer with ginger bread O.S. I used a 64 Gb sd card alone side Paragon exFAT, NTFS & HFS+ to make a continuously downloading torrent box the reason I require ftp transfer over data cable is that . Paragon exFAT, NTFS & HFS+ emulator is required to emulate NTFS formate that android cannot natively. Its is a required due to fat32 formated sd card gets detects but can not store more than 4Gb in one single unit for that NTFS formatted  SD card is required HTC explorer was also ideal b/c of the old O.S it allowed SD card to be used a secondary storage for apps this feature is no longer available due to security reasons in newer versions of android namely lollipop & marshmallow. When ever I connect data cable to transfer content from download folder to local drive Paragon exFAT, NTFS & HFS+ emulator has to be turned off n unmount the sd card then transfer content to local drive again after removing data cable its needs to detect the sd card n mount it as android does not have NTFS natively & the app is just exploiting the OS loop hole its not always the most stable thing n at times I had to struggle a lot to get it working again but if the transfer is wireless FTP then there is no such issues but the transfer speed in FTP is like 1/6th of the speed of cable  its very slow. A complete automated system is when I just decide what to download reset every thing is taken care off. That why I need a script to sync my seed box to local drive over FTP n not over data cable.

Anyway I have succeed in  modifying the script that was shown in the article to automatically sync my seed box to local drive. But I also require to upload torrent files that I download to my computer automatically to the watch folder of the torrent client running on the explorer so that they get added to the list of downloading torrents. Once they are downloaded they get shifted to completed folder from where they are sync back to local drive without any additional efforts from me completing the process without me getting involved or keeping my expensive gaming rig turned ON all night. 

So above is the concept what I tiring to achive.


----------



## Desmond (Mar 12, 2016)

One way to do that would be to set up a SSH server on your android device and transfer files from your phone using a FTP client such as WinSCP. But this will have to be done manually.

After some research, I have found that you can use the PSCP utility to transfer the files from SSH from the command prompt. What you could do is create a BAT file and put something like this in it:


```
pscp user@remote:\home\user\some\file.txt c:\some\path\to\a\
```

After this, create a new schedule in Windows' Tash Scheduler and set it to run at regular intervals.

The PSCP utility is part of the PuTTY suite and can be found here alongwith PuTTY: PuTTY Download Page

This is all theoretical, you will have to try this out and see if it works for you.


----------



## Zangetsu (Mar 13, 2016)

[MENTION=154537]Hakimtai[/MENTION] : Did u try the link I posted ?


----------



## Desmond (Mar 13, 2016)

To use wget, he will need a http or ftp server running on his phone. I don't know if that is even possible. However, an SSH server can run since there is an app that allows that.

Sent from my A0001 using Tapatalk


----------



## Zangetsu (Mar 13, 2016)

Hakimtai said:


> My objectives are
> 1. winscp should login to the ftp server  with login: anonymous & password: (nil, no password) at a given time ex: 11.00 pm or at the start of the pc as shown in the article
> 2. should look into a pre-specified folder in the seed box for any new file generated
> 3.  compares it to pre-specified folder on local storage
> ...



I don't think he needs mobile for the task ? does he

automate wget script is easy by using windows scheduler


----------



## Knight2A4 (Mar 16, 2016)

[MENTION=5007]Desmond David[/MENTION] , [MENTION=34930]Zangetsu[/MENTION] ......... Sorry guys for the late reply & thanks for showing support & investing time towards my topic been relay busy with my job & will try the methods you posted & reply back today evening hopefully.


----------



## Desmond (Mar 16, 2016)

Zangetsu said:


> I don't think he needs mobile for the task ? does he
> 
> automate wget script is easy by using windows scheduler



His seedbox is his mobile.


----------



## TheSloth (Mar 25, 2016)

Dayum, you people are insane! i didn't even understand his problem and you people are suggesting solutions!


----------



## Zangetsu (Mar 25, 2016)

lightningfassst said:


> Dayum, you people are insane! i didn't even understand his problem and you people are suggesting solutions!



C'mon dude...u shud understand you are lightning fast


----------



## TheSloth (Mar 25, 2016)

that term is just the opposite of my actual nature. I am actually a sloth.


----------



## Knight2A4 (Mar 27, 2016)

Hi Guys. So its been a while in between i broken my explorer when i tried to uninstall paragon NTFS emulator .... Have to boot with another Custom Rom the shift i had to go thought to get this thing working again. anyway below is the script i developed for sync new content from the Complete Download folder to local drive & to upload any new torrent from my local machine to the explorer.

option batch on
option confirm off
open user:JMsmrPyX@192.168.1.105:3332/
option transfer binary
synchronize local D:\Movies /mnt/sdcard/torrent/ready
keepuptodate C:\Users\hakimtai\Downloads\TorrentFile /mnt/sdcard/torrent/incoming
exit

O.K so the above is the script now let me explain. As i said before i had an old htc explorer am using a 64 GB sd crad to download all the torrent to my phone b/c i do not require it for my daily usage (have Moto G) it remains at home downloading from the wifi while am at work.
what i required was instead of manually using filezilla to download n upload content & torrent from phone to pc from pc to phone i wanted to automated the entire process so that i do not have to do it manually. There WiFi File Transfer this app makes your phone into a sever which can then be used for transferring file from n to with out any additional cables.

O.K am using WinSCP this article how to automatically backup your web server files with winscp over ftp/
Whats happening is the when i start windows WinSCP logs into the ftp server using the give credentials *open user:JMsmrPyX@192.168.1.105:3332/* then it looks to transfer binaries here *synchronize local D:\Movies /mnt/sdcard/torrent/ready * it sync local movie directory to ready (completed downloaded) folder from the SD card if it finds any new content in the sd card directory its start to download it into local movies directory once it completes this task it starts to monitor the folder C:\Users\hakimtai\Downloads\TorrentFile  for any new torrent that i download which get saved in this folder only as *.torrent* file get saved use *Save Text To File* plugin for firefox to separate .torrent files from others it gets uploaded to */mnt/sdcard/torrent/incoming * the folder which the torrent client on the phone is monitoring what ever .torrent file comes in this folder gets added to download list automatically.


----------



## TheSloth (Mar 27, 2016)

Guess I understand what were trying to do. So, is this script working or what? now everything is automatic?


----------



## Knight2A4 (Mar 27, 2016)

[MENTION=138367]lightningfassst[/MENTION] .... Yup its working ..


----------



## TheSloth (Mar 27, 2016)

^that's great. Nice work


----------



## Zangetsu (Mar 28, 2016)

well done..and do u keep the charger on to Moto G ?


----------



## Knight2A4 (Mar 28, 2016)

[MENTION=34930]Zangetsu[/MENTION] .... Its the explorer which is used for downloading if you mean that yes its kept on constant changing.


----------

