Credit to chatGPT:
In Windows 11, you can use a simple PowerShell command to "touch" all your files, updating their timestamps so OneDrive considers them "fresh" without making actual content changes. Here's how you can do it:
Steps to Update File Timestamps
Open PowerShell as Administrator:
- Press
Win + X
and select Windows Terminal (Admin) or PowerShell (Admin).
- Press
Navigate to the folder you want to "touch":
Run the following command to update the
LastWriteTime
for all files recursively:This will set the
LastWriteTime
of all files to the current date and time.
Explanation:
Get-ChildItem
: Retrieves all files and directories in the folder.-Recurse
: Processes all subfolders and their contents.ForEach-Object
: Iterates through each item.LastWriteTime
: Updates the timestamp toGet-Date
(current date and time).
Important Notes:
- Test First: Run this in a small test folder to ensure it behaves as expected.
- OneDrive Sync: After modifying timestamps, OneDrive should sync the updated metadata and treat the files as fresh.
- Preserve Original Timestamps: If you want to preserve original timestamps, back them up before running this script.
Let me know if you need further assistance!