Here's an Easter egg. I rarely answer non-MATLAB questions here but since I had to solve this today, I thought I'd share.
This batch file finds all .fig files in a directory and its subfolders (recursive search). Instructions:
- Create a new file with the .cmd or .bat extension.
- Copy-paste the script below into the file, adjusting the variables as needed.
- Update this line to specify the search directory: set "SEARCH_DIR=\\abc\def\"
- Update this line to specify the output file name, saved to the same directory as the cmd file: set "OUTPUT_FILE=FigFilesList.txt"
- Update the search term: (*.fig)
- Double-click on the file to execute the batch script.
Upon execution, the script will...
- ...open the terminal command window
- Search through the specified directory and its subdirectories for files with the .fig extension.
- Output the paths of these files to a text file named FigFilesList.txt.
- Every 200 fig files found, a message will be displayed in the terminal to indicate progress.
- A message will appear at the end to indicate that the seaerch is complete.
@echo off
setlocal EnableDelayedExpansion
set "SEARCH_DIR=\\abc\def\"
set "OUTPUT_FILE=FigFilesList.txt"
echo Listing all .fig files in
echo File list generated on
set /a FILE_COUNT=0
set /a MODULUS=200
for /R "%SEARCH_DIR%"
echo
set /a FILE_COUNT+=1
set /a RESULT=!FILE_COUNT!
if !RESULT! equ 0 (
echo Number of .fig files found so far: !FILE_COUNT!
)
)
echo List of .fig files saved to
echo **********Search complete**********
echo PROCESS COMPLETE >> "
endlocal