CMD 如何建立TXT內的文字檔名料夾 - Windows

By Steve
at 2018-10-28T04:03
at 2018-10-28T04:03
Table of Contents
剛開始學習cmd,目前在撰寫一個相片分類的bat
因為照片習慣依年分月份日期分類儲存
像是20180125 20180506 ...
目前已經進行到能讀取相片日期並存入文件檔內
想請為各位大大如何使用md代碼建立以txt內的檔名資料夾
程式如下
@ECHO on&setlocal enabledelayedexpansion
rem dir /o:d/t:w *.jpg
FOR /f "skip=4 tokens=1" %%i IN ('dir /o:d/t:w *.jpg') DO (
echo %%i>>a.txt
)
For /F "tokens=1-3 delims=/" %%a in ('Type a.txt^|Findstr ".*"') do (
echo %%a%%b%%c>>b.txt
set foldername=%%a%%b%%c
)
for /f "delims=" %%e in (b.txt) do (
if not defined %%e set %%e=Def & >>c.txt echo %%e
)
XCOPY Source "*""/foldername" /S /D:%%b-%%c-%%a /Y
rd 0 /S /Q
a.txt
b.txt
c.txt
pause
感恩
--
因為照片習慣依年分月份日期分類儲存
像是20180125 20180506 ...
目前已經進行到能讀取相片日期並存入文件檔內
想請為各位大大如何使用md代碼建立以txt內的檔名資料夾
程式如下
@ECHO on&setlocal enabledelayedexpansion
rem dir /o:d/t:w *.jpg
FOR /f "skip=4 tokens=1" %%i IN ('dir /o:d/t:w *.jpg') DO (
echo %%i>>a.txt
)
For /F "tokens=1-3 delims=/" %%a in ('Type a.txt^|Findstr ".*"') do (
echo %%a%%b%%c>>b.txt
set foldername=%%a%%b%%c
)
for /f "delims=" %%e in (b.txt) do (
if not defined %%e set %%e=Def & >>c.txt echo %%e
)
XCOPY Source "*""/foldername" /S /D:%%b-%%c-%%a /Y
rd 0 /S /Q
a.txt
b.txt
c.txt
pause
感恩
--
Tags:
Windows
All Comments
Related Posts
WIN10 defender導致網速變慢問題

By Hedda
at 2018-10-28T00:53
at 2018-10-28T00:53
微軟舊換新 買Surface laptop最多折4,500

By Valerie
at 2018-10-27T23:30
at 2018-10-27T23:30
如何放大 win10 小時鐘

By Franklin
at 2018-10-27T19:02
at 2018-10-27T19:02
windows 10 金鑰一事

By Emma
at 2018-10-27T15:05
at 2018-10-27T15:05
win10系統與獨立音效卡衝突問題

By Freda
at 2018-10-27T08:51
at 2018-10-27T08:51