I have scripted ForD.bat to determine if a NTFS file system object is a file or a folder.
ForD.bat uses the %~a1 syntax. If the first character of the attribute is a d, the object is a folder.
The syntax for using ForD.bat is:
\[call\] ForD FullyQualifiedFileSystemObject FDN
Where FullyQualifiedFileSystemObject is the fully qualified file or folder name, and FDN is a call directed environment variable that will contain:
Object is | Value |
File | F |
Directory | D |
Not Found | N |
ForD.bat contains:
@echo off if \{%2\}==\{\} @echo Syntax: ForD FullyQualifiedFileName ForD&goto :EOF if not exist %1 @echo ForD - %1 NOT found.&set %2=N&goto :EOF setlocal set FD=F for /f "Tokens=*" %%a in ('@echo %~a1') do ( set attr=%%a ) if /i "%attr:~0,1%" EQU "d" set FD=D endlocal&set %2=%FD%
0 comments
Hide comments