From 7ebe0e75f32412d7844aa2d1c5656da393f09afc Mon Sep 17 00:00:00 2001 From: AByte-L <1802171399@qq.com> Date: Thu, 21 Nov 2024 17:53:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=B9=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CopyToTzj-qh.bat | 24 ++++++++++++++++++++++++ CopyToTzj-qh.sh | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 CopyToTzj-qh.bat create mode 100644 CopyToTzj-qh.sh diff --git a/CopyToTzj-qh.bat b/CopyToTzj-qh.bat new file mode 100644 index 0000000..0beafdf --- /dev/null +++ b/CopyToTzj-qh.bat @@ -0,0 +1,24 @@ +@echo off +cd /d %~dp0 + +chcp 65001 > nul + +set "source_folder=book" +set "destination_folder=\\192.168.0.111\home\www" + +:: 确保目标文件夹存在,如果不存在则创建它 +if not exist "%destination_folder%" ( + mkdir "%destination_folder%" +) else ( + ::del "%destination_folder%" + del /Q /S "%destination_folder%" > NUL 2>&1 + ::del 移除空的文件夹 + rd /S /Q "%destination_folder%" > NUL 2>&1 + echo "清空文件夹: %destination_folder%" +) + +:: 复制文件夹 +xcopy /E /I /Y /Q "%source_folder%" "%destination_folder%" > NUL 2>&1 + + +echo "复制完成!" \ No newline at end of file diff --git a/CopyToTzj-qh.sh b/CopyToTzj-qh.sh new file mode 100644 index 0000000..c676d7a --- /dev/null +++ b/CopyToTzj-qh.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# 定义目录路径 +SOUR_DIR="/book" +DEST_DIR="\\192.168.0.111\home\www" + +# 删除旧目录 +if [ -d "$DEST_DIR" ]; then + echo "Deleting $DEST_DIR" + rm -rf "$DEST_DIR" +else + echo "$DEST_DIR does not exist." +fi + +# 复制新目录到目标目录 +if [ -d "$SOUR_DIR" ]; then + echo "Copying $SOUR_DIR to $DEST_DIR" + cp -r "$SOUR_DIR" "$DEST_DIR" +else + echo "$SOUR_DIR does not exist." +fi + +echo "Script completed."