Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I performed a clean install of Windows 7 Pro on one machine. I also performed a clean install of Windows 10 Pro on another machine. Both machines are on a LAN isolated from any other network including the internet.Furthermore, no updates were installed on either machine and there is also no other software applications installed on either machine.Each machine just has the operating system installed.I developed a vbscript that deletes archived folders, its subfolders and contents older than six months from the present's date.The app uses the DeleteFolder method with optional Boolean parameter is set to true

object.DeleteFolder ( folderspec[, force] );

Here is my code

if (objFSO.FolderExists(strBackupFoldToDelete & strInternationalDate)) then
objFSO.DeleteFolder(strBackupFoldToDelete & strInternationalDate), true

The app executes successfully and flawlessly on Windows 7 Pro but preemptively terminates with an error 800A004C Path not found error on Windows 10 Pro.

Any suggestions why 800A004C Path not found error occurs in Windows 10 Pro?
Have implemented every possible variation of the parentheses to no avail.


Gracious regards

What I have tried:

every variation of the parentheses DeleteFolder method
Posted
Updated 13-Mar-20 9:58am
Comments
phil.o 13-Mar-20 14:36pm    
What are the values held by strBackupFoldToDelete and strInternationalDate variables?
micromaestro 15-Mar-20 16:09pm    
followed your suggestion and the error persists. The paths are absolutely identical on both windows 7 pro and windows 10 pro. The data is identical.Both machines are connected to the same storage device. The ONLY variable is the operating system; one is windows 7 pro 64 bit the other is windows 10 pro 64 bit. The code is IDENTICAL.The user is administrator on both machines.The code deletes archived built-in MyDocuments and built-in Desktop folders on the storage device when executed on windows 7 pro but preemptively terminates on windows 10 pro with path not found.Most appreciative and gracious for your effort and advice.
phil.o 15-Mar-20 16:15pm    
I get that these are identical values on both OSes. My question is: what are these actual values? Because it is possible for a given path to be accessible on Windows 7 and not on Windows 10, due to changes in file system security between both generations.
micromaestro 16-Mar-20 18:46pm    
Hey all. I have located the culprit but not the solution.The archived folders contain the built-in Documents, Desktop, Favorites, and Downloads and other user folders. When the DeleteFolder method is executed, the built-in Favorites and Downloads folders along with the other user folders and its contents are ALL deleted but the built-in Documents and Desktop folders are not causing the error.Even though the optional Boolean value is set True if files or folders with the read-only attribute set causing the files or folders to be deleted
Any suggestions would be most appreciative
phil.o 17-Mar-20 0:24am    
I would advise not to delete the folders but only their archived contents. You don't want to mess with user folders like documents or desktop, since they can be referenced at countless other places, especially in the registry. An archiving script should not delete high-level user root folders.

Windows 10 (and 8 on which it is based) are a lot more security conscious than Windows 7: you no longer own your machine, and many, many folder will need explicit permissions to access them which the user your app is running under probably just doesn't have.

For example, all folders under "Program Files" are by default "read", "list", and "execute" enabled for all users, but are explicitly not "modify" or "write" enabled.
If you try to delete a file under "Program Files" you will get an "Access denied" exception unless your app is running with elevation.

So start by finding out what user you are executing under (again, different in Win10) and then find exactly what the path your are drying to remove is. Then check the permissions on that folder and it's parent. Almost certainly, that's your problem.

This may help: Where should I store my data?[^] - it's probably worth changing how your code works to use "sensible" data folders as the security we have will only get tighter, not more flexible!
 
Share this answer
 
Comments
micromaestro 15-Mar-20 19:21pm    
E:\Archive\Clients_20190813_2000 for instance.That is the full path containing archived backup folders
OriginalGriff 16-Mar-20 3:59am    
And does that folder exist on the Win10 machine? Which users have the right access permissions to it?
micromaestro 16-Mar-20 18:45pm    
Hey all. I have located the culprit but not the solution.The archived folders contain the built-in Documents, Desktop, Favorites, and Downloads and other user folders. When the DeleteFolder method is executed, the built-in Favorites and Downloads folders along with the other user folders and its contents are ALL deleted but the built-in Documents and Desktop folders are not causing the error.Even though the optional Boolean value is set True if files or folders with the read-only attribute set causing the files or folders to be deleted
Any suggestions would be most appreciative
There is a third option. The path you built using string concatenation is not a valid path. This is usually because what you think variables contain is not what they contain.

For example, if your strBackupFoldToDelete variable contains "D:\SomeData\" and your strInternationalDate variable contains "01-02-2020.txt", your code will build a path that looks like this:
D:\SomeData\01-02-2020.txt"

But, if your strBackupFoldToDelete variable contains "D:\SomeData" (see the difference?), the result will be a very different path:
D:\SomeData01-02-2020.txt


DO NOT BUILT PATH NAMES inside your method calls. Build the path and store the result in a variable to make the code easier to debug. Doing that would have allowed you to show the path it's attempting quite easily.
 
Share this answer
 
Comments
micromaestro 15-Mar-20 16:09pm    
followed your suggestion and the error persists. The paths are absolutely identical on both windows 7 pro and windows 10 pro. The data is identical.Both machines are connected to the same storage device. The ONLY variable is the operating system; one is windows 7 pro 64 bit the other is windows 10 pro 64 bit. The code is IDENTICAL.The user is administrator on both machines.The code deletes archived built-in MyDocuments and built-in Desktop folders on the storage device when executed on windows 7 pro but preemptively terminates on windows 10 pro with path not found.Most appreciative and gracious for your effort and advice.
micromaestro 15-Mar-20 19:21pm    
E:\Archive\Clients_20190813_2000 for instance.That is the full path containing archived backup folders
Dave Kreskowiak 15-Mar-20 21:33pm    
I don't know what to tell you. That path you built doesn't exist on the Win10 machine.
micromaestro 16-Mar-20 18:45pm    
Hey all. I have located the culprit but not the solution.The archived folders contain the built-in Documents, Desktop, Favorites, and Downloads and other user folders. When the DeleteFolder method is executed, the built-in Favorites and Downloads folders along with the other user folders and its contents are ALL deleted but the built-in Documents and Desktop folders are not causing the error.Even though the optional Boolean value is set True if files or folders with the read-only attribute set causing the files or folders to be deleted
Any suggestions would be most appreciative

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900