Batch file to create a folder based on current date & time
Go to solution
Solved by WereCatf,
1 minute ago, Ziondaman said:yes i want it to do it in E:\Dump
Then it's just:
@echo off
E:
cd E:\Dump
REM Create directory
for /f "skip=1" %%i in ('wmic os get localdatetime') do if not defined fulldate set fulldate=%%i
set year=%fulldate:~0,4%
set month=%fulldate:~4,2%
set day=%fulldate:~6,2%
set foldername=%year%.%month%.%day%
mkdir "%foldername%"
REM Move all files, except the batch-file itself
for %%i in (*) do if not "%%i" == "%~nx0" move "%%i" "%foldername%\%%i"

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now