Page 1 of 1

Get list of recently modified files

Posted: 2019 Jun 24, 15:16
by sanferno
Hi,

I have created a batch script to backup into 7z files the contents of one specific folder, let's say: C:/Data
With that I'm able to create full backups but I would also like to create differential backups, only including the files modified in the previous day. I've found this page:
https://www.windows-commandline.com/fin ... fied-time/

And this command is what I need, but I would like to get the full path so when the files are compressed in the 7z file, it keeps it's real location.
forfiles /P C:\Data /S /D +24/06/2019

Could someone help me, please?

Re: Get list of recently modified files

Posted: 2019 Jun 24, 15:59
by nikos

Re: Get list of recently modified files

Posted: 2019 Jun 24, 18:34
by sanferno
Hi Nikos, that's not bad at all, but it's not what I'm looking for.

Now, using this batch file I'm able to compress in a 7zip file the full contents of C:/Data. The next approach I want is to just archive the files modified over the last week in that same folder. This is so easy with x2, but I'd like to achieve that with CMD (to automate it) and keeping the same folder structure. This way I avoid creating full backups frequently for bigger folders, but at the same time I could join/overwrite one full with the following differential.

Re: Get list of recently modified files

Posted: 2019 Jun 24, 23:02
by sanferno
Woo! I finally found it! :party:

Here's the command:
xcopy %source_folder% %destination_folder% /d:%MM-DD-YYYY% /s /i

This copies the files and folders created after the given date and keeps the folder structure in the destination.

Hope it helps someone in the future :wink: