Skip to content

Instantly share code, notes, and snippets.

@brake
Created June 1, 2016 08:22
Show Gist options
  • Select an option

  • Save brake/2613978771023d2c732020c48f4e8d3f to your computer and use it in GitHub Desktop.

Select an option

Save brake/2613978771023d2c732020c48f4e8d3f to your computer and use it in GitHub Desktop.
Create a new directory and move desired files here (like Create directory from selection in Mac Finder)
@echo off
set proceed=true
if "%1"=="" set proceed=false
if "%2"=="" set proceed=false
if %proceed%==false (
echo.
echo Create directory and move desired files to it.
echo.
echo Usage:
echo ^<dir name^> ^<file1^> ^<file2^> ... ^<fileN^>
exit /b
)
echo Creating dir %1
echo.
md "%~1"
set destination="%~1"
shift
:loop
if not "%~1"=="" (
echo | set /p dummy=Moving file %1 ...
move "%~1" "%destination%" >nul
echo Done
shift
goto loop
)
echo.
echo All done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment