CodePudding user response:
Delete might involve under permission problems thank you for your help very urgentCodePudding user response:
command1_click ()
Dim f as string
D="C: \ Users \ 123. TXT"
If dir (f) & lt; & gt;" "Then
Kill f
End the if
CodePudding user response:
We might want to use.CodePudding user response:
If your problem is deleting files, you can use vb kill statements for file deletion,If your problem is to search the files in the folder, you can use the dir function recursive method in the vb implementation file directory search, of course, the simple point can also be used with FileListBox DirListBox controls or fso or wmi object,
If your problem is a directory or file permissions, it will have to see if your current running program permissions have sufficient privileges to modify the directory or file, but also to see your partition table is NTFS can determine whether need permissions, if is FAT32, can consider this problem, it is not necessary to for NTFS partition, if you have administrator privileges, so usually is able to operate most of the directory or file, of course, if the directory or file is used by the system or lock, you can't delete, in addition to this kind of circumstance, is your users or groups of users is not set to the directory or file, so have no right to operation, if this is the case can be
The Shell "CMD/C Cacls" & amp; Directory address & amp; "/T/E/C/G" & amp; The user account & amp; ":" F, vbNormalFocus
Will you permissions to the target directory or the safety of the target file, after you have the right to operate the directory or file.