I need to be able to upload a local folder (created daily) to a remote FTP everyday.
I’ve messed with WinSCP file masks (i.e. put -filemask="*>=today" C:\local\ /) and ran into issues where it would upload the latest folder (contained subfiles) but it would also upload the rest of the folders in the directory. (they were empty) I then realized filemasks only works specifically for files, not folders.
I then came across this thread: Download files newer than X days from SFTP server with WinSCP, skipping folders that do not contain any matching files
User had the same issue except he was going Remote -> Local whereas I need the opposite, solution was to use PowerShell
Considering that thread is a couple years old, does WinSCP scripting now support such a feature? Unfortunately I’m a bit of a novice with PowerShell.
Thanks for your time.
WinSCP does not support time constraints for folders.
But what has changed (since the other question) is that now you can prevent WinSCP from creating the empty folders. Use -rawtransfersettings switch with ExcludeEmptyDirectories setting.
put -rawtransfersettings ExcludeEmptyDirectories=1 -filemask="*>=today" C:\local\ /
If you really need to upload the latest folder (as opposite to uploading the folder with the latest files), using WinSCP .NET assembly from your favourite language (like PowerShell) is still the way to go, as shown in the other question.
Related
Good day.
I'm using WinSCP to synchronise a folder on a remote server to a folder on my computer (my local folder becomes the copy). The folder contains lots of .TXT and .LOG files, and a few subfolders also containing the same filetypes. I use the Commands -> Static Custom Commands -> Keep local directory up to date feature to keep my local folder synchronised. This feature spawns a PowerShell script which checks the remote folder every 30 seconds. If there's any new/changed files, it downloads them to my local folder. This worked for months, but suddenly it's seeing many old files as 'changed' when they aren't. Every time WinSCP checks the remote folder it will detect 1200+ changed files when in reality only 3 or so have changed. It will download all of those 1200, then check remote folder again and detect the number of files as 'changed', downloading them all again. Note that the number of 'falsely changed' files can differ on every remote check, varying between ~900 and ~1300 files. The total number of files + folders in the remote directory is ~2470. This cycle of false-positive change detection continues endlessly, downloading thousands of files insteads of the 2 or 3 that it should.
I've tried re-installing the WinSCP, deleting the server bookmark and making a new one, and running WinSCP as admin. None of these work.
I'm connecting to a remote server via FTP protocol, without encryption.
--Update to Martin Prikryl--
Two sessions have been logged, download these logs here.
A few notes:
I tried running this on a subfolder called 'archive-08-2020' to limit logsize, but I couldn't reproduce the problem. This subfolder did a full sync of it's ~800 files, but noticed no changed files after the first sync round. Hence the two WinSCP logs are from operations on my main, large folder. Sorry for this inconvenience.
On both sessions, the logfiles have iterated over all files in the folder several times already while the PowerShell screen is still working on the first run of downloading all of them in order.
The files in the remote folder start at chatlog_2020-09-01_0121.txt but the PowerShell window only starts at chatlog_2020-10-25_0334.txt each time, even on consecutive iterations within the same session. WinSCP session log also starts at chatlog_2020-09-01_0121.txt.
The remote folder has 4 subfolders: archive-05-2020 through archive-08-2020. The archive-08-2020 files are logged in the WinSCP session log, but none of the other subfolders are.
One example of a file that should not have updated but still did is chatlog_2020-11-30_2210.txt
It seems that the timezone offset autodetection fails with your particular FTP server for some reason. It may started failing with end of daylight saving time in October?
Try to disable the timezone offset autodetection at the Environment page of Advanced Site Settings dialog. Try setting it to 0:00.
Does the Notepad++ have Local and FTP synchronizer by any plugin?? because I develop websites using PHP and notepad++ has all the features I like and its really lightweight but I had to switch to Netbeans because I use a web hosting but I always like to save the code in my computer too. and netbeans can do that, even anything you insert locally in the folder it automatically adds the folder and the files in the FTP server which is great. but if the notepad++ has the feature to at least update the files that we are saving in notepad++ in both local and ftp server I would be so glad, I search that for a long time, but I can't use netbeans anymore I lose way too much time, netbeans is really heavy!
Thanks!
NppFTP: a plugin that allows FTP,
FTPS, FTPES and SFTP communications.
Very useful for web development.
Author: harrybharry
Homepage: http://sourceforge.net/projects/nppftp/
Install it from Plugin Manager
These are NppFTP plugin panel and toolbar button
Open profile settings dialog
Then configure profiles
Just wanted to post this here for anybody looking for the same solution I was looking for... (and I think helps answer this question more thoroughly).
I keep an exact replica of my public_html directory on my local machine. I wanted to be able to double click a file on the remote server and live edit so that I had a mirrored copy on my local machine. Note: if you are looking for functionality similar to Dreamweaver's site manager... there is a feature request for that. This solution only allows your local files to get updated when you edit a remote file.
So here goes the basic connection settings (pretty standard):
h: some.ftphost.com
u: some_ftp_user
p: a_very_secure_password
d: /public_html
Then, here is where the magic comes in. Under the "cache" tab for the ftp profile, add the following:
Local path: E:\Path\to\your\local\server\public_html
External path: /public_html
The external path should be the same as the "initial directory" in your connection settings. Hope this makes sense. Please ask questions if you have any.
Then what you need is rather FTP_synchronize
double-clicking file will open it for
editing and saving file (in usual way)
will update it on server .
I actually prefer the way that Notepad++ works with FTP compared to Netbeans. Notepad++ always treats the remote file as the master copy. So when you open it, it first downloads it and stores it in the local cache. Netbeans however always opens the local copy first - you have to explicitly synchronise with the external server to pull down the files from the server. If you're working with other developers - its much better to use the server copy so that you pull down any changes by other developers.
If you want the synchronisation try these steps:
In Notepad++ | NppFTP | Global Settings | Set the Global cache to be C:\inetpub\wwwroot\%USERNAME%#%HOSTNAME% which works for IIS or change the directory to your webserver root directory
You will have to make sure Notepad++ has permissions to create directories in your server root
Download one file from the server using NppFTP so that you can see what the directory struction looks like you can probably put just %HOSTNAME% e.g. C:\inetpub\wwwroot\domain.com
Then use Filezilla to download all the files into that directory - you can also use Filezilla to check for synchronisation changes.
Then use NppFTP which will download the files into that structure.
You should then be able to access the files through localhost/domain.com
If you're the only one working on the project that should then be enough, but if there are others, or if you make changes elsewhere you can use Filezilla to check the file timestamps to synchronise.
The default install for Notepad++ has a Plugin called NppFTP on the Plugins menu. I don't know how feature-full it is, however.
Get NppFTP
Connect to ftp.xxxx.com
Double click file to open
Edit changes
Save with automatic upload
I am thoroughly in love with TextMate. I program everything in it, including ASP.NET for my daily job. However, I have a license for Espresso, and I was looking at it recently and discovered that there is a "Publish" section that I knew about before, but I didn't know that it could compare my FTP directory with my local directory and publish only the changed files.
Over the past week I've been finding myself using Espresso just for that functionality. However, I was hoping there was a way to get this functionality inside TextMate. I know that you could use an AppleScript script with Cyberduck (my FTP client) to upload a file when it changes, but I have never got that working and it also doesn't include the ability to merge files like Espresso does.
Am I plumb out of luck? Am I stuck using two different programs for the forseeable future?
I haven't tried it, but you should be able to set up a simple rsync command in a bundle in TextMate that will use environment variables from your project to synchronise.
See Using rsync to enable the project drawer in TextMate while working on a remote server for an example.
Does anybody know a decent freeware FTP utility, preferably that can run in the background, that can mirror a local folder, constantly checking the files there for changes, and then automatically refreshing the FTP folder when the local files change?
WinSCP has a "keep remote directory up to date" feature under the commands tab which I use to do this. It first asks whether you want to sync the whole directory, then automatically uploads any file as soon as you save it. I'm currently looking for a similar solution for Mac.
I am interested in this as well. I know about the Rsync option of course, but would like to have a Windows option that does the same thing..
Thanks Everyone. I ended up using the FastNet NMFTP component in Borland C++ Buidler 5 to write my own Windows Version of Sync.
If you are running on a Linux or UNIX box you can use a shell script that periodically runs under cron to sync a folder to a "master" folder. You could use rsync in that shell script to do the actual sync.
Is that helpful?
David Kerins
I have a website written in PHP under source control (SVN). I would like to move at once all my files from the website directory to production server.
The problem is that in this folder there are folders of SVN (.svn). The second problem is that i do not want to put on the server only files under source control, but also other in this folder (images, css, and so on).
Could you please tell me how to do this? It would be nice if it would be repeatable - that so I would have only one command to execute.
And if there would be any possibility to optimize uploading (not uploading not changed files) to make whole process of going production faster would be nice too.
EDIT:
My development environment is Eclipse PDT and favorite FTP filezilla.
You can use the export function of subversion, this will allow you to export all files under version control, but also all files NOT under control. Both methods will skip the .svn folders.
You didn't mention your client, but Tortoise has the 'export unversioned files too' option.
See here for commandline syntax
You can use an ftp client if it's support filters (exclude .svn folders, i.e FlashFXP).
Currently I'm using Nusphere PhpEd IDE's built in feature called "Smart upload", so it only updates changed files (with modified time changed).
I use rsync which is a fast command line tool which only sends the changed parts of files. You can set it up to exclude .svn directories as outlined here:
If you wish to continue doing this with fileZilla you can go to View->Filename Filters and select to ignore SVN and CVS directories. You can also only upload changed files with FileZilla however I find rsync far faster. As rsync is command line based you could easily hook it up with Eclipse as an external tool to enable 1 click transferring
You can use springloops, they cover SVN commit and checkouts but most importantly deployment to FTP server with a click of a mouse...
I stumbled recently on the same issue running Ubuntu 9.
In FileZilla you can choose ignore filters which contain even presets to prevent copying .svn folders and windows .thumb files! You can find this in the View menu under Filename filters... Works like a charm!
Thumbs up for the FileZilla folks!