- BrunoJ
- Joined:
- Posts:
- 5
Local File Deletion Error
Advertisement
Since upgrade to V6.1, I cannot manually delete local files using WinSCP. Should there be a PowerShell command for doing this?
Advertisement
-
martin◆
Site Admin - Joined:
- Posts:
- 41,441
- Location:
- Prague, Czechia
Re: Local File Deletion Error
Thanks for your report.
Please provide us step-by-step instructions for reproducing the problem.
Do you get any error? Or what exactly happens?
I have no issues with deleting local files in WinSCP 6.
Please provide us step-by-step instructions for reproducing the problem.
Do you get any error? Or what exactly happens?
I have no issues with deleting local files in WinSCP 6.
- BrunoJ
- Joined:
- Posts:
- 5
Requested Steps
- Select file from display of local folder
- Press delete key
- Question appears: "Are you sure you want to move file '@DELETE THIS.jpg' to recycle bin?"
- Press OK button
- Error appears: "Error deleting file 'C:\...\@DELETE THIS.jpg'" (I have replaced the actual path in this display with an ellipses for privacy purposes. The path is correct.)
-
martin◆
Site Admin - Joined:
- Posts:
- 41,441
- Location:
- Prague, Czechia
Re: Requested Steps
Thanks. Though, it works for me.
I believe the error message should contain more details, please post complete message.
Are you sure the problem is related to WinSCP upgrade?
Can you try downgrading to 5.21.7? Would the problem go away?
https://sourceforge.net/projects/winscp/files/WinSCP/5.21.7/WinSCP-5.21.7-Setup.exe/download
I believe the error message should contain more details, please post complete message.
Are you sure the problem is related to WinSCP upgrade?
Can you try downgrading to 5.21.7? Would the problem go away?
https://sourceforge.net/projects/winscp/files/WinSCP/5.21.7/WinSCP-5.21.7-Setup.exe/download
- BrunoJ
- Joined:
- Posts:
- 5
Error Message
That is the complete error message. See the attached image.
Advertisement
Error Disappeared
I reverted to V5.21.8 and was able to delete a file. I then re-installed V6.1 and was still able to delete a file. Gremlins?
-
martin◆
Site Admin
Re: Error Message
Ok. Did you try the downgrade?
Re: Error Message
As I said previously.
-
martin◆
Site Admin
Re: Error Message
Sorry, I didn't read your response carefully.
I have sent you an email with a debug version of WinSCP to the address you have used to register on this forum.
I have sent you an email with a debug version of WinSCP to the address you have used to register on this forum.
Advertisement
-
pferrucci
Guest
I have the same problem. I am using version 6.3.1 using the commande line.
I am logged as mydomain\currentuser and the MSDOS console is opened as "administrator" so I should be able to delete any files.
I execute:
...
I used the
Here are the permissions on
Here are the permissions on
If I delete
I am logged as mydomain\currentuser and the MSDOS console is opened as "administrator" so I should be able to delete any files.
I execute:
WinSCP.com /command "open myftp-details-here" "synchronize local -delete \Install /Install -filemask=|.stfolder/;.stversions/" exit
Synchronizing... Error deleting file '\Install\one-directory\one-simple-file'. System Error. Code: 5. Access denied
icacls
tool to look at the user permissions.
Here are the permissions on
one-directory
:
BUILTIN\Administrators:(I)(OI)(CI)(F) NT AUTHORITY\System:(I)(OI)(CI)(F) mydomain\currentuser:(I)(OI)(CI)(F) OWNER:(I)(OI)(CI)(IO)(F) BUILTIN\Users:(I)(OI)(CI)(RX) BUILTIN\Users:(I)(CI)(S,WD,AD)
one-simple-file
:
BUILTIN\Administrators:(I)(F) NT AUTHORITY\System:(I)(OI)(CI)(F) mydomain\currentuser:(I)(F) BUILTIN\Users:(I)(RX)
one-simple-file
from Windows explorer, it deletes it not even asking for an elevation.
- Guest
@pferrucci: You might try re-installing 6.3.1 over the current installation. That appears to have fixed it for me. (I actually re-installed the previous version first, but I'd give either way or both a try.)
- Elwood
- Joined:
- Posts:
- 6
There's nothing to install. I used the portable version. It's just 2 files, WinSCP.exe and WinSCP.com
Thanks
Thanks
-
martin◆
Site Admin
@pferrucci: The file might have been temporarily locked by another application (e.g. by an antivirus), at the time WinSCP was trying to delete it.
Reinstallation as suggested by @Guest can indeed hardly help.
Reinstallation as suggested by @Guest can indeed hardly help.
Advertisement
- Elwood
- Joined:
- Posts:
- 6
I just reinstalled WinSCP 6.3.4.14955 on a non-default directory, unchecking everything other than the program in the installer.
I executed my one line Winscp.com command and I still have:
I executed my one line Winscp.com command and I still have:
If you want me to run a debug version of WinSCP, feel free to provide one. I'll be happy to help.System Error. Code: 5.
Access denied
- Guest
(I'm not the guest above.) But sometimes perms between an application and files are not as expected. It gets kind of crazy in certain situations. Like one might think that the application has the correct run permission when it doesn't or when another piece doesn't or maybe it doesn't to a certain storage device even if the files are. There's potential for all kinds of weird things.
There can in theory also be red herring situations where it might not actually be a perm issue at all such as one example that Martin gave where the file is locked by whatever as this isn't a perm issue. There's potentially other situations that can cause red herrings.
Perms are often not at the application's fault.
You should see if another application works or not. If it does work then there's something with this application and how its working or configured, and if it doesn't, then you have some other not WinSCP thing going on.
A log may or may not help much here. Depends.
There can in theory also be red herring situations where it might not actually be a perm issue at all such as one example that Martin gave where the file is locked by whatever as this isn't a perm issue. There's potentially other situations that can cause red herrings.
Perms are often not at the application's fault.
You should see if another application works or not. If it does work then there's something with this application and how its working or configured, and if it doesn't, then you have some other not WinSCP thing going on.
A log may or may not help much here. Depends.
- Elwood
- Joined:
- Posts:
- 6
You are right.
I report here because :
Oh and I didn't say: I have the same behaviour on many Windows (all of them are servers but they are probably different versions, 2016, 2019...etc.)
I report here because :
- I run WinSCP "as administrator"
- even without it (i.e. as normal user), using the Windows Explorer, I can delete the file that gives problems to WinSCP
- I also reinstalled as suggested.
Oh and I didn't say: I have the same behaviour on many Windows (all of them are servers but they are probably different versions, 2016, 2019...etc.)
-
martin◆
Site Admin
Can you create a Windows batch file that first (unsuccessfully) tries to delete the local file using
winscp.com
and synchronize local -delete
and then deletes the same file using Windows del
command? Post the batch file and its output and logs.
Advertisement
- Elwood
- Joined:
- Posts:
- 6
Damn! You are right.
I am so surprised I can't delete this file from an MSDOS script, even if I run it as the domain administrator!
So as I want to fully understand, I spent some time on this and I found what blocks the file deletion. This is because the file has the ReadOnly attribute (you can see it on the Properties window, first tab).
So in MSDOS, using
So how can I do the equivalent with WinSCP? Any "-forcedelete" option? Or just "really delete" as it's what it is supposed to do anyway :-p
Thanks
I am so surprised I can't delete this file from an MSDOS script, even if I run it as the domain administrator!
So as I want to fully understand, I spent some time on this and I found what blocks the file deletion. This is because the file has the ReadOnly attribute (you can see it on the Properties window, first tab).
So in MSDOS, using
del myfile
is not enough, you need to use del /F myfile
.
So how can I do the equivalent with WinSCP? Any "-forcedelete" option? Or just "really delete" as it's what it is supposed to do anyway :-p
Thanks
-
martin◆
Site Admin
Cannot you just remove the read-only attribute?
Deleting read-only files
Deleting read-only files
- Elwood
- Joined:
- Posts:
- 6
Yes I can. It's just one more scan of the root directory, whereas WinSCP already scans this directory when using
But I see now that it's not even intended in the API (https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilew).
So I'll do it myself.
I then suggest to add a note in the description of the
Thanks to all.
synchronize
, so it could be more elegant if WinSCP could do it.
But I see now that it's not even intended in the API (https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilew).
So I'll do it myself.
I then suggest to add a note in the description of the
-delete
switch (https://winscp.net/eng/docs/scriptcommand_synchronize), unless you want to answer such question again by someone else :-P
Thanks to all.
Advertisement
You can post new topics in this forum