csmba
csmba

Reputation: 4083

powershell or other script to make files creation date = modified date

something messed up my mp3 and image library. Now, the files have correct modified data but the creation date is newer!

That for some reason makes using robocopy to backup my library impossible (robocopy thinks files are always changing, even when they did not).

I saw some tools people wrote to let you edit via gui or even cmd line the properties of files, but all expect you to tell them the date you want to set. that will not work since I have files in different dates cross 10 years.

i figured it is a simple powershall script to iterate over folder/sub folder and set each files creation date to be the modified date.

Any poweshall wizard that can show me the way? or at least get me started?

Upvotes: 3

Views: 5860

Answers (1)

ravikanth
ravikanth

Reputation: 25800

Get-ChildItem -recurse -filter *.mp3 | % { $_.CreationTime = $_.LastWriteTime }

That should do the job.

Upvotes: 11

Related Questions