04.02.2026, 12:12
(This post was last modified: 10.02.2026, 20:39 by Dale Yarker.)
Since we code, I thought some PB rather than Command Prompt is appropriate.
An empty hidden folder not much of a threat, ISFOLDER works either way.
DIR$ a bit more complicated, and needs a file in the hidden folder to find the folder.
edit - added kill for contained files. RMDIR needs directory empty to delete it.
Code:
'PBWin 9 / 10 or PBCC 5 / 6
'
#compile exe
#dim all
#if %def(%pb_cc32) 'ignored by PBWin compiler
#console off 'no unneeded console window by PBCC
#endif
'
function pbmain () as long
local hTWin as dword
local AppDataPath, Target, A_File as wstring
local FoundFolder as long
local FolderDat as dirdata
AppDataPath = environ$("APPDATA")
Target = "\TestHidden\"$$ 'make more generic with TXT.LINE.INPUT or COMMANS$
'\Microsoft\ ''for test on an existing
'\TestHidden\ ''I created on my pc with hidden attribute for testing
'\Bluetooth\ ''subject directory, hopefully you don't find
txt.window ("Search For Hidden Directory In AppData", 300, 150, 15, 50) to hTWin
'
txt.print build$("Search in: "$$, AppDataPath)
txt.print build$("For subdirectory: "$$, Target)
Target = build$(AppDataPath, Target)
txt.print '
FoundFolder= isfolder(Target)
if FoundFolder then
txt.print "The directory/folder "$$;
txt.color = %rgb_red -&hF
txt.print "exists."$$
txt.print "Verify you want to delete it with ""D"" or ""d""."
txt.waitkey$
do
A_File = dir$(Target +"*.*"$$, 6)
if len(A_File) then
setattr Target + A_File 0 'kill won't delete hidden files.
kill Target + A_File
else
exit loop
end if
loop
rmdir Target
else
txt.print "The directory/folder was "$$;
txt.color= %rgb_forestgreen
txt.print "not found."$$
end if
'
txt.color = %rgb_green
txt.print
txt.print
txt.print "Any key to close."$$
txt.waitkey$
end function DIR$ a bit more complicated, and needs a file in the hidden folder to find the folder.
edit - added kill for contained files. RMDIR needs directory empty to delete it.
