Supplement
Replace start "" D:\TMP\sm..\ in the code with start "" "%CurDir%sm..\"
Replace start "" D:\TMP\sm..\ in the code with start "" "%CurDir%sm..\"
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Originally posted by HAT at 2008-6-28 17:34:
Add a fox loop to exclude sm..\, then use xcopy /i, maybe it can be done. Going to eat first, we'll discuss it again when I get back.
Originally posted by philon at 2008-6-28 21:22:
I changed cls&echo Copying file "%~1" ...... to cls&echo Copying file ......
Haha
:xxxx
cls&echo Copying file%status%
xcopy /y/h/r "%~1" "%~dp2" >nul
set status=%status%.
goto:eof
@echo off&mode con cols=70 lines=12
setlocal enabledelayedexpansion
set CurDir=%~dp0
color 5b&cls&echo.
set /p Name=Enter a folder name! Folder names with spaces are not supported
if not defined Name color 0c&cls&echo.&echo You didn't enter any characters!&&ping/n 3 127.1>nul&exit
title Create or delete a private folder
if not exist %Name%..\nul (
md "%Name%..\"
for /f "skip=1 tokens=4*" %%a in ('dir/ad/x "%CurDir%%Name%.*"') do if not defined ShortName set "ShortName=%%a"
color 5a&cls&echo.&echo The private folder has been created! Files will be put into the private folder...&ping/n 2 127.1>nul
for /f "delims=*" %%a in ('dir/ad/s/b "%CurDir%"^|findstr /i /v "\%Name%."') do md "%CurDir%!ShortName!\%%~nxa"
for /f "delims=*" %%i in ('dir/a-d/s/b "%CurDir%"^|findstr /i /v "\%Name%. .bat .cmd"') do (
set "SourceFile=%%i"
set "DestinationFile=!SourceFile:%CurDir%=!"
call :xxxx "!SourceFile!" "%CurDir%!ShortName!\!DestinationFile!"
)
ping/n 2 127.1>nul
start "" "%CurDir%%Name%..\"
) else (
rd /s/q "%Name%..\"
color 5e&cls&echo.&echo The private folder has been deleted!&ping/n 2 127.1>nul
)
color 5b&cls&echo.&echo Run it again to recreate or delete!&ping/n 2 127.1>nul
exit
:xxxx
if not defined count set count=0
if %count% gtr 50 set status=.&set count=1
cls&echo Copying file%status%..
xcopy /y/h/r "%~1" "%~dp2" >nul
set status=%status%.&set /a count+=1
goto:eof