Why does WinSCP see remote files as changed/updated when they aren't? - ftp

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.

Related

Only upload the latest folder to FTP (Local -> Remote)

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.

File system gets stuck in 'FileSystemObject.DeleteFile'

I have one automation project which does the job of building the setup using NSIS wrapper. The project is built with the VB6 code. During the execution of the project I am getting the error for deleting a file as “Method 'DeleteFile' of object 'IFileSystem3' failed” for the method ‘FileSystemObject.DeleteFile’ with force option set to true.
Scenario:
Server (Windows server 2012) drive is mapped to the local windows 7 system and whole operation is run in this mapped drive in client machine. And the project is run on the client machine.
Now when I run my project to build the setup, it copies all the application files to a folder called Temp under build1 and build2 directory and then it builds 2 separate setup exe using the NSIS (makeNSIS). After the creation of NSIS setups, it will delete all the source files from temp folder. While deleting the MDAC_TYP.exe file, I get the error as mentioned above. The above said error comes for both the Build1 & Build2 folders and the error comes occasionally (not every time) for the same exe.
I cannot rename/delete/move the file in any of the PC through UNC or even in server it cannot be deleted. If I try to rename/delete the file or its parent folder, the system from where I try to delete/rename gets stuck.
Other methods I tried are as below.
Tried my project under testing environment and there was no such error.
Checked for file handle using process explorer in both client as well as server – No handles were found
Checked for Open files in the Shared folders of the server. - No open file connection found for the file.
Tried rebooting the client machine – Not solved.
Tried to delete/Rename the file using command in server – Not possible.
Tried to delete/rename the file in server – No error and no message. Instead, server gets stuck.
Checked for disk problems using chkdisk in server. No problems reported.
Folder permission – The user ha full permission and there is no issue.
Tried running the same build process after reboot – Everything works fine. But, again repeats after some time/day.
Tried disconnecting the mapped drive at the time of error exists. But, still not able to rename.
No antivirus/Event viewer log in both client as well as server
After all these still I could not able to explain why exactly the error occurring.
Update:
I recently noticed that the same error also occurs when deleting the file msstdfmt.dll
Update 2:
I also got error for the ms word file, error is same. In all the 3 cases i found that there is only a common thing that is all 3 files has read-only attribute.

Deleting Files on a Network Drive that are opened by another User

I have an odd issue currently.
I have a build script that essentially will copy over some files to a directory on a networked drive and initially had an issue where some people were leaving these files open on their machines, causing my build to fail.
A solution came up to simply delete the entire file, because theyre build artifacts, but the other day the folder itself was opened and locked.
I cannot think of a solution to unlock the folder and forcefully close any open files.
Various file unlockers don't seem to work on folders our on a networked drive from my machine.
I figure people have been copying files for years and have had this issue before me, so what are some ways you can get around this file locking issue besides asking someone to close a file or folder?
General Info:
Windows Server
Windows Local Machine
Transfer via UNC Paths
Thanks!

Directory Monitor keep an eye on new files, modifications, deletions, renames and file access in Windows Server

Is there any tool in Microsoft windows server 2012 keep an eye on a specific folder and get notified and changes need to be made automatically in another folder with in same server whenever changes occurs in one folder .
These vary from new files, modifications and deletions to renames and file access. It is capable of working with network folders too .

Automatic transfer to ftp after any file is modified

Is there a Windows option, FileZilla option, other FTP program or some other program I can use that will copy any file I modify in a directory to a directory in an FTP Server?
Situation: I'm doing my development in my machine with my own server, but since it can't be broadcast, I have it serving from another domain. I'm in the beginning stages so code is changed every minute, but it is tiresome to copy the modified files to the FTP every time and also remember the ones that need to be copied.
So, I want a program that will check my directory and upload any modified files to the FTP.
Netbeans has its own "Project from a Remote Server". And it will auto sync any changed file!
Tested and worked.
Thanks to Mikecito for the suggestion.

Resources