How to Change TimeStamp for multiple files/folders? (via PowerShell)

조회 수: 8 (최근 30일)
Mark Golberg
Mark Golberg 2020년 3월 30일
댓글: shirish pataki 2020년 7월 2일
Hey,
I've found the following command:
!powershell $(Get-Item temp.m).lastwritetime=$(Get-Date \"11/24/2015 05:00 am\")
Indeed it changed the "Date Modified" of my temp.m file to be 24-Nov-2015 05:00.
Now I'd like to run it in a loop, where I can control the file name (or folder name), and also control the date?
For example -
I have 90 folders. I'd like to give to the first 5 certain date, then to the second batch of 5 folders give another date, etc...
I'm quite newbie with PowerShell syntaxing. Apprecieate the help.
THANKS !!!
  댓글 수: 1
shirish pataki
shirish pataki 2020년 7월 2일
hello
default_dir = < Directory where file is present >
DestinationFileName = 'ABC.m' - You can choose it in a loop
system(['powershell $(Get-Item ' default_dir '\' DestinationFileName ').lastwritetime=$(Get-Date \"11/24/2015 05:00 am\")']);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by