如何将TXT文件夹中的所有文件都移动到TEMP文件夹?
发布网友
发布时间:2022-12-17 11:13
我来回答
共1个回答
热心网友
时间:2023-09-16 01:10
不清楚你的实际文件/情况,仅以问题中的说明为据
复制粘贴到记事本,另存为xx.bat,编码选ANSI@echo off
rem 将一个指定文件夹/目录里的文件剪切/移动到另一个新文件夹里
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
set "oldfolder=D:\xxx\TXT"
set "newfolder=D:\yyy\TEMP"
if not exist "%oldfolder%" (echo;"%oldfolder%" no found&goto end)
if "%oldfolder:~-1%" equ "\" (set "oldfolder=%oldfolder:~,-1%")
if "%newfolder:~-1%" equ "\" (set "newfolder=%newfolder:~,-1%")
(echo;Do While WSH.StdIn.AtEndOfStream=False
echo;f=WSH.StdIn.ReadLine
echo;WSH.echo f ^& "|" ^& replace^(f,WSH.Arguments^(0^),WSH.Arguments^(1^),1,1,1^)
echo;Loop)>"%tmp%\v.v"
for /f "tokens=1* delims=|" %%a in ('dir /a-d/b/s "%oldfolder%\" 2^>nul^|cscript -nologo -e:vbscript "%tmp%\v.v" "%oldfolder%" "%newfolder%"') do (
if not exist "%%~dpb" (md "%%~dpb")
echo;"%%a" --^> "%%b"
rem move "%%a" "%%~dpb"
)
echo;%#% +%$%%$%/%@% %z%
pause
exit