Reputation: 1
your text
Hello
your text
I have a folder that contains a series of files. The file inside is added every day
your text
Now, I wanted to write a command that every time I run it, it will check the files in this folder your text
one by one and transfer the files whose creation date has been over 2 months to another folder.
your text
Thank you for your guidance
your text
set ta=%date%
your text
set mah_now=%date:~4,2%
your text
set src=d:\sour_folder
your text
set dest=d:\des_folder
your text
for /f "skip=5 tokens=1,2,4,5* delims= " %%a in ('dir %src% /a:-d /o:d /t:c') do (
your text
if "%%~c" NEQ "bytes" (
your text
@echo file name: %%~d
your text
@echo creation date: %%~a
your text
for /f " tokens=1,2 delims=/" %%j in ("%%a") do (
your text
set /a taf_mah=%mah_now% - %%~j
your text
if %taf_mah% GTR 2 (
your text
move %src%%%~d %dest%
your text
)
your text
)
your text
)
your text
)
Upvotes: 0
Views: 27
Reputation: 1
@echo off
set ta=%date%
set mah_now=%date:~4,2%
set src=d:\sour_folder
set dest=d:\des_folder
for /f "skip=5 tokens=1,2,4,5* delims= " %%a in ('dir %src% /a:-d /o:d /t:c') do (
if "%%~c" NEQ "bytes" (
@echo file name: %%~d
@echo creation date: %%~a
for /f " tokens=1,2 delims=/" %%j in ("%%a") do (
set /a taf_mah=%mah_now% - %%~j
if %taf_mah% GTR 2 (
move %src%\%%~d %dest%
)
)
)
)
Upvotes: 0
Reputation: 1
I have a folder that contains a series of files. The file inside is added every day Now, I wanted to write a command that every time I run it, it will check the files in this folder one by one and transfer the files whose creation date has been over 2 months to another folder. The commands I wrote are below, but they don't work Thank you for your guidance
Upvotes: 0