Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

richsilv

Any ideas? I am fairly "naive" to WinSCP scripting...
If I can "collect" filenames into a Window Variable I have a chance to split up the Get and Delete...
Even if I can execute an ls into a Windows variable... I might be able to twist things...
martin

Re: Get -Delete fails intermittently

No, WinSCP cannot delay the file removal.
Guest

Re: Get -Delete fails intermittently

It actually turns out that the SFTP Account we are using does not have rename capability...
So I can split the get and -delete actions, but this introduces an admittedly small window where, if a file arrives in the folder during the get, it would be deleted before its been received...
richsilv

Re: Get -Delete fails intermittently

Here you go...
richsilv

Re: Get -Delete fails intermittently

I received this response from CommerceHub Support...

My internal team was able to get back to me about the errors you are seeing. They advised that the delete command is being issued to quickly. You will want to setup a slight delay between download completions and deleting.

Is there a way to "Insert a Slight Delay"?
FWIW, the Command that is having issues is...
get -delete *.intchg E:\EDIA\IN\CommHub\HOLD\*.intdec

I am considering changing the get -delete *.intchg to something like
mv *.intchg *.intdec
get *.intdec E:\EDIA\IN\CommHub\HOLD\
rm *.intdec

The extra rename step to make sure I avoid even the slightest possibility of a new file landing in the Folder between the get and rm...

Comments?
martin

Re: Get -Delete fails intermittently

Please post session log files.
1) from the "old server", where it always succeeds.
2) log of failure on the new server.
richsilv

Get -Delete fails intermittently

Current version of WinSCP 5.17.7 (Build 10640) running on Windows Sserver 2016 Std
Previous Version 5.75 (Build 5665) running on Win Svr 2008 R2
Protocol in use SFTP via Scripting...

We have been using WinSCP to down/up load files for years from a script

We recently migrated to new Servers, I installed the latest WinSCP...
Now the get -delete command fails to delete the file "sometimes"...
The get always succeeds... The -delete claims it gets either a "Permission Denied" or "File in Use" error... And reports Error Code 3... A snippet of what gets reported is below...

If I return to the "Old Server", the commands still always succeed...
FWIW, I use WinSCP to down/upload files to two separate SFTP Servers...
One of them (SPS Commerce) still succeeds always...
The other of them (CommerceHub) is the one that is failing... (I am in contact with their Support too, although they claim they cannot help...)
Ideas? Its tempting to uninstall the "Latest Release" and install the Back Level release to see if that changes things...
batch           continue  

confirm         off       
echo            on       
open sftp://accesslight:***@accesslight.sftp.commercehub.com/ -hostkey="ssh-rsa 2047 B2yOH2cQEQqo8gCxi5PbjIhb8py5tYXbxGU3DIxDdoM="
Searching for host...
Connecting to host...
Authenticating...
Using username "accesslight".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] accesslight@accesslight.sftp.commercehub.com
cd /outgoing/intchg
/outgoing/intchg
get -delete *.intchg E:\EDIA\IN\CommHub\HOLD\*.intdec
14551380841.md59EB9D4F588F84107FF40C5FC929C351B.intchg |          925 B |    0.0 KB/s | binary | 100%
14551604629.md5F3EC0CE0B76C07D9DCF4210A22B324F3.intchg |          821 B |    1.4 KB/s | binary | 100%
14552484715.md5FB3B732DB2302F1982233713FD4927AF.intchg |          849 B |    1.7 KB/s | binary | 100%
14552624075.md5AD8D1EF04C78D616E37CED811C20E512.intchg |          900 B |    2.1 KB/s | binary | 100%
Error deleting file '/outgoing/intchg/14552624075.md5AD8D1EF04C78D616E37CED811C20E512.intchg'.
Permission denied.
Error code: 3
Error message from server: Failed to delete file /outgoing/intchg/14552624075.md5AD8D1EF04C78D616E37CED811C20E512.intchg: The process cannot access the file '\\edgeprodcfs1.commercehub.com\sftp_share\sftp_fs\accesslight\outgoing\intchg\14552624075.md5AD8D1EF04C78D616E37CED811C20E512.intchg' because it is being used by another process.
(A)bort, (R)etry, (S)kip, Ski(p) all: Skip
14552624075.md5AD8D1EF04C78D616E37CED811C20E512.intchg |          900 B |    1.9 KB/s | binary | 100%
14552693504.md56B3C6A459494A53758AAFC260D01E2F9.intchg |          817 B |    2.1 KB/s | binary | 100%
Error deleting file '/outgoing/intchg/14552693504.md56B3C6A459494A53758AAFC260D01E2F9.intchg'.
Permission denied.
Error code: 3
Error message from server: Failed to delete file /outgoing/intchg/14552693504.md56B3C6A459494A53758AAFC260D01E2F9.intchg: The process cannot access the file '\\edgeprodcfs1.commercehub.com\sftp_share\sftp_fs\accesslight\outgoing\intchg\14552693504.md56B3C6A459494A53758AAFC260D01E2F9.intchg' because it is being used by another process.
(A)bort, (R)etry, (S)kip, Ski(p) all: Skip
14552693504.md56B3C6A459494A53758AAFC260D01E2F9.intchg |          817 B |    1.9 KB/s | binary | 100%
14553479988.md5D926C969FF35BD7879702E309243C3C8.intchg |          835 B |    2.0 KB/s | binary | 100%
cd /incoming/intchg
/incoming/intchg
put -delete -nopermissions -nopreservetime -resumesupport=off E:\EDIA\OUT\CommHub\HOLD\*.asc *.edi
No file matching '*.asc' found.
close
Session 'accesslight@accesslight.sftp.commercehub.com' closed.
No session.
exit