简体   繁体   中英

How to write a Windows Batch Script to Move files and delete on same script

H,

I need to create a script to run as a pre-script on our Backup schedule to first move files to a destination folder and delete files older than x days on that dessication folder.

I know I can use Robocopy and forfiles to create separate tasks but i need to run it on the same script..

eg:-

move files in c:\\Backup\\ to D:\\Old_Backup and search for files older than 3 days on D:\\Old_Backup and delete them from D:\\Old_Backup folder.

Thanks in advance...

I'd be happy to help you to improve, I just do not understand your question.

If you want to write script for Windows I encourage you to learn how to use PowerShell .

As you describe it, I do not see any reason why you cannot writes it in a single script. Thus my supposition is that maybe it is not clear for you what a script exactly is.

You can write several commands line in your script, thus it should be easy to write a script moving required files and deleting other required files in the same script.

Edit: you will find all required ressources here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM