Get list of recently modified files

Products and tips

Moderator: Site Mods

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

Get list of recently modified files

Post 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?
User avatar
nikos
Site Admin
Site Admin
Posts: 15771
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: Get list of recently modified files

Post by nikos »

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

Re: Get list of recently modified files

Post 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.
sanferno
Silver Member
Silver Member
Posts: 288
Joined: 2013 Nov 30, 18:40

Re: Get list of recently modified files

Post 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:
Post Reply