Get list of recently modified files

Products and tips

Moderator: Site Mods

Post Reply
sanferno
Silver Member
Silver Member
Posts: 266
Joined: 2013 Nov 30, 18:40

Get list of recently modified files

Post by sanferno » 2019 Jun 24, 15:16

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?

User avatar
nikos
Site Admin
Site Admin
Posts: 14450
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: Get list of recently modified files

Post by nikos » 2019 Jun 24, 15:59


sanferno
Silver Member
Silver Member
Posts: 266
Joined: 2013 Nov 30, 18:40

Re: Get list of recently modified files

Post by sanferno » 2019 Jun 24, 18:34

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.

sanferno
Silver Member
Silver Member
Posts: 266
Joined: 2013 Nov 30, 18:40

Re: Get list of recently modified files

Post by sanferno » 2019 Jun 24, 23:02

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:

Post Reply