-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MoveFilesAndFolders - "Cannot delete source Directory" error #151
Comments
Also, it apparently moved the 'System Volume Information' folder o.0 |
Can you upload a job file so I can see exactly what settings you are using, and a example directory structure so I can try and replicate it here? As for "System Volume Information" then yes I would expect it to move that as well if the source is the root of a drive and you haven't added it as an excluded directory, also happens with $RECYCLE.BIN |
( I already added the SVI folder to ignored list) |
I will investigate further tomorrow as getting late here now, but I see what you mean, I also see that get the exact same error running from command line using RoboCopy, so at least we know it is a RoboCopy issue rather than a RoboSharp issue. Pretty certain I have seen something similar in the past when using RoboCopy for server data migrations. |
Two potential solutions:
If this is a know issue, and really the only time it occurs is when using the |
Neither solution works when using RoboCopy from command line - not yet tried in RoboSharp |
What type of file system does the USB drive have? The one I was testing with and having the same error as you with was formatted as FAT32? I converted it to NTFS and it now works fine without any errors at all :)
|
2GB Fat32 disks. These are boot software for a system, so reformatting to a different format won't work. I'll play around and see if I can't resolve it |
Ahh okay, thats a shame - definitely a permission issue relating to ACL on root of a drive hence working on NTFS and not on FAT32 - unfortunately RoboCopy works so much better on NTFS as half of its features are designed for that type of file system. Let me know how you get on though |
P.S. Just out of interest it seems for some switches such as /MIR that System Volume Information is automatically excluded according to the logs - never knew this named (-1) - E:\System Volume Information\ |
Yes I had that same thought and tried it as well. I think your logic above makes sense and I agree with why you think it is happening. In my opinion perhaps rather than stopping it showing in OnError perhaps just get it to show a better explanation of why the error occurred e.g. append a "friendly" error message explaining what we know to it? |
The check could be done after the description 'Access is denied' is added to it, and we append " - Safe to ignore: /MOVE with root of drive as source causes this fault (cannot delete root of drive)" Or something. Not really sure how to describe it for public consumption. Since this is going to be an issue, and my app currently throws a pop up showing the error and suspends the copy process, I'm going to filter it out manually in my event handler. (I don't think it's worth it for a single error like this, but if more 'known non-error errors' occur, maybe worthwhile to add a static class with filters to detect and ignore them raising the event/append friendly description, obviously on basis. Defaults would obviously be show them with friendly, with bool toggle to just not raise event. |
Yes that would make sense and certainly help new users understand when an error is not really an error so to speak. It is hard to know how to describe it for public consumption - you and I understand it as we have discussed it, but new people coming to it may not, perhaps as you say just perhaps prevent it showing for now then but with plenty of comments in the code and perhaps a link back to this issue maybe? |
Yea, linking to this thread is easy enough to do, with a concise summary of what it prevents raising as well. Let's get @tjscience opinion on that code screenshot before I submit a PR with it. I think that unless we notice more 'nonsense errors' like that, creating a whole class with toggles and descriptions wouldn't make sense. As far as I'm aware, this is the only one that exists, and it's a quirk of using FAT32 root as source and with the move tag, so fairly niche I would think. (A network path root as source would also likely introduce the issue, but either way erroring due to inability to delete a drive root is likely an oversight by robocopy devs) |
Completely agreed on both counts :) |
My project is taking ALL files and folders EXCEPT 2 folders from the Root of a USB stick, and stuffing them into a backup folder on the root of the USB.
For example:
Source: E:
Destination:
$"E:\USB_BACKUP\{DateTime.Now.ToString("yyyy-MM-dd_hh_m_tt")};"
turns into
All that works, but RoboCopy reports an error that it cannot delete the source directory, which is typically done during the 'MoveFilesAndFolders'. I know WHY its erroring - It can't delete the source from the drive because the source IS the root of the drive.
Any idea how to prevent that error being generated?
The text was updated successfully, but these errors were encountered: