Guest User

Simple and fast file locator

a guest
Oct 19th, 2015
1,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. @echo off
  2. ::-----------------------------------------------------------------------------------------------
  3. ::SCRIPT EXPLANATION
  4. :: This script will search for a file (in current directory) and provide the location,
  5. :: file size, and date/time last modified.
  6. ::------------------------------------------------------------------------------------------------
  7.  
  8. ::MAIN SCRIPT
  9. :start
  10. cls
  11. set /p userfile="Which file to search?: "
  12. echo.
  13.  
  14. ::***Search entire dir tree, set variable for location and folder (~dpG).***
  15. echo File location:
  16. dir /s /b "%userfile%" || echo. && pause && goto:start
  17. for /f "tokens=*" %%G in ('dir /s /b "%userfile%"') do set file1=%%G
  18. for /f "tokens=*" %%G in ('dir /s /b "%userfile%"') do set location=%%~dpG
  19. echo.
  20.  
  21. ::***Set variable for file size (~zG) and variable for date/time modified (~tG)***
  22. for /f "tokens=*" %%G in ('dir /s /b "%file1%"') do set size=%%~zG
  23. echo Size: %size% bytes
  24. for /f "tokens=*" %%G in ('dir /s /b "%file1%"') do set timestamp=%%~tG
  25. echo Timestamp: %timestamp%
  26. echo.
  27.  
  28. set /p open="Open file location (y/n)?: " || goto:start
  29. if %open%==y goto:open
  30. goto:start
  31.  
  32. ::***Open folder (variable set in ~dpG)***
  33. :open
  34. cd %location%
  35. start.
  36.  
  37.  
  38. echo.
  39. pause
  40. goto:start
Advertisement
Add Comment
Please, Sign In to add comment