完全访问网络共享文件夹 [英] Full access to Network Share folder
问题描述
大家好,
我在网络共享文件夹上有事可做。但是当我在互联网上搜索时,它只给我一个代码才能在自己的计算机上完成。我想做的步骤是:
1.检查目的地(网络共享文件夹)路径是否为空。
2.删除文件夹内容(不是主要内容)例如:\\USER-PC\File\;文件夹文件无需删除,但内部内容需要删除。
3.将文件夹内容从源文件复制到新目的地。
编号为1和3。但尚未找到第2号。如何删除网络共享文件夹中的目录?
删除我使用的目录代码,但异常未找到网络路径。:
My.Computer.FileSystem.DeleteDirectory(strDestination,FileIO.DeleteDirectoryOption.DeleteAllContents)
请协助。 TQ
听起来像你没有该文件夹的删除目录权限。在同一台计算机上,您是否可以手动删除该文件夹。如果您有权手动删除内容,那么您应该能够手动迭代文件然后删除它们。
eg
Dim Files() As 字符串 = IO.Directory.GetFiles(ThePath)
对于 每个文件在文件
IO.File.Delete(文件)
下一步跨度>
Hi all,
I have something to do on network shared folder. But when I search on Internet, it giving me a code to do in own computer only. Step that I want to do is:
1. Check destination (network shared folder) path is empty or not.
2. Delete folder content (not the main one) eg: "\\USER-PC\File\"; the folder "File" no need to deleted, but the content inside is need to deleted.
3. Copy folder content from source to new destination.
No. 1 and 3 is coded. But No. 2 is not yet found. How to delete a directory on Network Shared Folder?
Delete directory code that I use but exception "The network path was not found.":
My.Computer.FileSystem.DeleteDirectory(strDestination, FileIO.DeleteDirectoryOption.DeleteAllContents)
Please assist. TQ
It sounds to me like you don't have delete directory permission to the folder. From the same machine, are you able to delete the folder manually. If you have permission to delete the contents manually, then you should be able to manually iterate through the files and then delete them.
e.g.
Dim Files() As String = IO.Directory.GetFiles(ThePath) For Each File In Files IO.File.Delete(File) Next
这篇关于完全访问网络共享文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!