How to Change File and Folder Date & Time Attributes Via the Command Line

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ส.ค. 2024
  • If you need to change the date created, modified or accessed attribute of a file or folder, you can do so using PowerShell with some simple commands. You can even change the date and time attributes for all files within a folder with one command.
    Here are the notes from the video.
    DATE CREATED
    (Get-Item "PathToItem").CreationTime=("15 January 2022 10:00:00")
    SAMPLE
    (Get-Item "C:\demo\File1.txt").CreationTime=("15 January 2022 10:00:00")
    -------------------------------------------------------------------------------
    DATE MODIFIED
    (Get-Item "PathToItem").LastWriteTime=("16 January 2022 11:00:00")
    SAMPLE
    (Get-Item "C:\demo\File2.txt").LastWriteTime=("16 January 2022 11:00:00")
    -------------------------------------------------------------------------------
    DATE ACCESSED
    (Get-Item "PathToItem").LastAccessTime=("17 January 2022 12:00:00")
    SAMPLE
    (Get-Item "C:\demo\File3.txt").LastAccessTime=("17 January 2022 12:00:00")
    -------------------------------------------------------------------------------
    If date accessed is not changing then run
    fsutil behavior set disablelastaccess 0
    -------------------------------------------------------------------------------
    CHANGE ATTRIBUTES FOR ALL FILES IN A FOLDER
    Get-ChildItem -force PathToItem * | ForEach-Object{$_.CreationTime = ("15 January 2022 10:00:00")}
    Get-ChildItem -force PathToItem * | ForEach-Object{$_.LastWriteTime = ("15 January 2022 10:00:00")}
    Get-ChildItem -force PathToItem * | ForEach-Object{$_.LastAccessTime = ("15 January 2022 10:00:00")}
    SAMPLE
    Get-ChildItem -force C:\demo\Folder1 * | ForEach-Object{$_.CreationTime = ("15 January 2022 10:00:00")}
    Here is a writeup of the process on our website.
    onlinecomputer...
    Learn More:
    Check out our online training courses!
    madeeasytrainin...
    Check out our book titled Windows 11 Made Easy to take your Windows skills to the next level!
    www.amazon.com...
    #dateandtime
    #filemanagement
    #fileexplorer
    #windowstipsandtricks
    #windowstips

ความคิดเห็น • 14

  • @Wonky1000
    @Wonky1000 ปีที่แล้ว +5

    It would be difficult to overstate how much I appreciated this!

  • @s.franco5744
    @s.franco5744 ปีที่แล้ว +2

    This worked perfectly, thank you so much. I organize my folders chronologically and need them to have the same creation date.

  • @kenopiana1647
    @kenopiana1647 ปีที่แล้ว +1

    Everything is Working man, thank you ❤

  • @mfrostel7459
    @mfrostel7459 ปีที่แล้ว +1

    Thx for the video

  • @meimokke
    @meimokke ปีที่แล้ว +1

    thanks I can secretly hide files now

  • @sanismpe
    @sanismpe ปีที่แล้ว

    Thanks. It is very helpful. currently I was able to make changes in first level only in the folder case. Attributes of the files in subfolders remain unchanged. Is there anyway to access all files nested in subfolders and below?

  • @koneser7947
    @koneser7947 2 หลายเดือนก่อน +2

    can you change the date of creation of a folder itself?

    • @koneser7947
      @koneser7947 4 วันที่ผ่านมา

      you can, use attribute changer

  • @aritraray2501
    @aritraray2501 ปีที่แล้ว +1

    How to change the date of folder

  • @user-sz2di2sj3b
    @user-sz2di2sj3b 8 หลายเดือนก่อน

    Do you have a script command that will change files in the subfolders of a folder?

  • @JohnyWolf1
    @JohnyWolf1 5 หลายเดือนก่อน

    How can you do this for directories/folders?

  • @losingthings1021
    @losingthings1021 ปีที่แล้ว

    Can anyone see that the date has been changed?

  • @gunasheelsonu1037
    @gunasheelsonu1037 9 หลายเดือนก่อน

    when i send a file to a another it is showing the same date. How? @OnlineComputerTips