Estoy tratando de escribir un programa por lotes rápido que copie los nombres de los archivos en una carpeta o esa carpeta y las subcarpetas. El problema que tengo es: no quiero los nombres de directorio.
Aquí está mi código:
if %_JOB%! NEQ ! set _JOB=%_JOB%-
if %_FOLDERS%! == y! set _FOLDERS=Y
echo Created %cdate% > "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
echo Folder: %CD% >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
if %_FOLDERS%! == Y! (
echo Include sub-folders: True >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
) ELSE (
echo Include sub-folders: False >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
)
echo. >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
echo ============================== BEGIN LIST ============================== >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
if %_FOLDERS%! == Y! (
dir *.pDF /s /b /A-D-H >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
) ELSE (
dir *.pdf /b /A-D-H >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
)
echo =============================== END LIST =============================== >> "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
cls
echo.&echo List Generated!
echo.&echo.&ECHO.Press ANY key to EXIT and view your file
PAUSE>NUL
start notepad "C:\Users\%username%\Desktop\%_JOB%PDFlist.txt"
EXIT