S
S
Sergey2015-08-20 10:19:52
cmd/bat
Sergey, 2015-08-20 10:19:52

Help writing a batch file?

Hello.
Please help and make, preferably, one .bat file, for all three points, to move files, here's what you need:
1. You need to transfer all files (only files, not folders) from c:\ARHIVE to the folder C:\ARHIVE\ current month (in the format, for example: August) \ current day (in the format dd.mm.yy), respectively, if there is no current day folder, create it, if there is no month, create it, and then the day there, if any, then do not create, but simply transfer the files there.
2. similarly, only from the folder k:\PLAT to k:\PLAT\ARC
3. similarly, only from the folder k:\STAT to k:\STAT\ARC

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2015-08-20
@DRAKAR

well, help is advice too.
Here are two options for you:
CMD :
date (in the format specified in the regional settings of windows. by default it is dd.MM.yyyy) date /T
list of files in the folder and subfolders without directory names dir /S /A :-D
moving a file : move
creating folders mkdir
date : Get-Date
From a date you can separately (and relatively easily) get the day, month, year :
(Get-Date).Day
(Get-Date).Month
(Get-Date ).Year

List files in folder and subfolders without directories : Get-ChildItem -recurse -file
Check if directory exists :Test-Path C:\foldername
Creating a directory: New-Item -itemtype directory c:\foldername moving
files: Move-Item

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question