M
M
Michael Compass2022-02-14 14:28:24
PowerShell
Michael Compass, 2022-02-14 14:28:24

How can I change the creation dates of files in a folder?

Using Powershell code, I assign the file creation date - to each file in folder 1a , based on the digit of the name of each file.
The files in the folder are numbered like this:
1.mp4
2.mp4
3.mp4
....
9999.mp4
This powershell code assigns (which is what I need) the dates of creation to the files (day of the month) in ascending digits of the name , and should be in descending digits of the name . How to fix it?

dir C:\Users\home64\Downloads\1a -file | sort -property name | %{$i=0} {$_.CreationTime = (Get-Date).AddDays($i); $i++}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question