简体   繁体   English

用于将文件从一台服务器移动到另一台服务器超过 45 天的批处理脚本

[英]batch script to move files from one server to another older than 45 days

can someone help to write windows batch script to move files older than 45 days from one system to another whcih is added in network and domain.有人可以帮助编写 Windows 批处理脚本以将超过 45 天的文件从一个系统移动到另一个系统,该系统已添加到网络和域中。

Example : Move files older than 45 days from folders A, B, C of System1 to A, B, C of System 2.示例:将超过 45 天的文件从 System1 的文件夹 A、B、C 移动到 System 2 的 A、B、C。

I have tried running below code but it is working fine if my source and destination is same server but it is not working when source and destination is diff server.Server2 Folder ie A,B are shared folders and Server1 have access to it我试过运行下面的代码,但是如果我的源和目标是同一台服务器,它工作正常,但是当源和目标是不同的服务器时它不起作用。Server2 文件夹,即 A,B 是共享文件夹,Server1 可以访问它

@echo off & setlocal enableextensions
net use m: "\\System2\d$\A\"
Forfiles -p \\System1\d$\A -s -m *.* -d -45 -c "cmd /c move /y @FILE m: & echo %Date% Source File: @PATH to \\System2\d$\A\">>D:\Test\logfile.txt
net use /delete m:
net use n: "\\System2\d$\B\"
Forfiles -p \\System1\d$\B -s -m *.* -d -45 -c "cmd /c move /y @FILE n: & echo %Date% Source File: @PATH to \\System2\d$\B\">>D:\Test\logfile.txt
net use /delete m:
GOTO :eof

Take a look at robocopy.exe .看看robocopy.exe It is part of standard installations since Vista/Server 2008. It has command line parameters that can be used to select files of certain ages.它是自 Vista/Server 2008 以来标准安装的一部分。它具有命令行参数,可用于选择特定年龄的文件。 Type robocopy /? robocopy /? for details.详情。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于将超过 30 天且具有特定扩展名的文件移动到另一个文件夹的 Windows 脚本 - Windows Script to move files older than 30 days with a specific extension to another folder 批处理脚本可将文件从scource移到目标文件夹,以保存30天以上的文件 - Batch script to move file from scource to destination folder for files older than 30 day Windows批处理文件:移动超过10天的文件和不带特定字符串的文件名 - Windows batch file: move files that older than 10 days and the filename without a specific string 批处理文件将超过30分钟的文件从一个文件夹复制到另一个文件夹 - batch file to copy files older than 30 minutes from one folder to another 用于删除超过 X 天的文件的批处理脚本(基于创建日期,而不是修改日期) - Batch script to delete files older than X days (based on creation date, not modified date) 使用批处理脚本将文件从一台服务器传输到另一台服务器 - Transfer files from one server to another using batch script Windows批处理脚本,用于基于文件名搜索文件,检查文件是否早于N天,如果为true,则删除这些文件 - Windows batch script for searching files based on file name,checks if the files are older than N days, if true, it deletes those files 批处理文件删除超过N天的文件 - Batch file to delete files older than N days 如果所有文件都超过3天,则批量文件删除目录中的子文件夹 - Batch file to delete subfolders in directory if all files is older than 3 days Windows 批处理文件删除超过 X 天的文本文件 - Windows Batch file to delete text files older than X days
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM