I have few html files with .htm extension and its supported files in another directory.
For example : html file name is 41debcd7-75f2-469a-8833-8bda79995009.htm and its supported directory name is 41debcd7-75f2-469a-8833-8bda79995009_files, which contains styles/images/etc used in html file.
this html file is created using MS word Save as Type-> "Web Page(.htm;.html)"
I want to copy HTML file with its supported files to some other directory using CMD. I am able to copy HTML files(have multiple html in directory) and supported directory with below command but all support files are not getting copied(only html copied) xcopy " *.htm" "f:\TestCMD" /s /e
Can anyone please help in copying html and all supported files of html using cmd?
The XCOPY
command is good for copying subdirectory structures.
SETLOCAL ENABLEDELAYEDEXPANSION
SET "FILENAME=41debcd7-75f2-469a-8833-8bda79995009.html"
SET "TARGET_DIR=C:\src\t\htest"
FOR %%f IN ("%FILENAME%") DO (
SET "SUBDIR=%%~nf_files"
IF NOT EXIST "%TARGET_DIR%\!SUBDIR!" (MKDIR "%TARGET_DIR%\!SUBDIR!")
COPY "%FILENAME%" "%TARGET_DIR%"
XCOPY /V /S /E /I "!SUBDIR!" "%TARGET_DIR%\!SUBDIR!"
)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments