How to check last time a file was accessed?
How to check last time a folder was accessed?
PowerShell codes below will be able to check files and folders, for last write time or last accessed time.
Code below is from Technet:
http://technet.microsoft.com/en-us/library/e811c7ac-c793-4dc2-82a0-92d08b0f660b
$(Get-Item c:\scripts).lastaccesstime
It will check the last access time for the specified parent folder path.
Code below will list all the:
Folder and Sub folders plus last write time for each folder. (list folders only)
Get-ChildItem -Recurse "D:\powershell scripts" | ?{ $_.PSIsContainer } | Select-Object FullName,lastwritetime
Code below will list all the:
Files and folder plus last write time for each folder and files. (folders and files)
Get-ChildItem -Recurse -Path "D:\powershell scripts\" $_.PSIsContainer| Select-Object FullName, LastWriteTime
Below code will list all the:
Files in every folder, which includes LastwriteTime and its file name. (files only)
Get-ChildItem -Path "D:\powershell scripts" $_.LastWriteTime -Recurse
Folder name has space in between, need enclosed path in quotation marks.
List all directories display result in descriptive format:
Get-ChildItem "D:\powershell scripts\" -Recurse | where {$_.PSIsContainer -eq 'Directory'}
To when was the last time a file was modified or written, for example you have a document or a file that is shared and the file needs to be updated constantly. But you are not sure whether file is being updated or modified, PowerShell can help to check the file properties when was the last time it was written or modified.
(Get-item C:\Users\Administrator\WIP_Document\Sales_Doc_Input.docx).Lastwritetime
Sample output will be like this:
Friday, November 24, 2017 7:16:54 AM
Cheers!!! Till next time!!!
==============================
Divine Mercy Chaplet Guide:
https://play.google.com/store/apps/details?id=com.dmercyapp
Educational App for Android Kids:
https://play.google.com/store/apps/details?id=com.letsmultiply
Catholic Rosary Guide:
Android Divine Mercy Chaplet Guide
https://play.google.com/store/apps/details?id=com.dmercyapp
How to check last time a folder was accessed?
When files and folders are just sitting on a shared folder
and just occupying space for an unknown reason, such questions will easily pop.
If there's a need to check files and folders, last write time or last accessed time PowerShell can be very handy.
PowerShell codes below will be able to check files and folders, for last write time or last accessed time.
Code below is from Technet:
http://technet.microsoft.com/en-us/library/e811c7ac-c793-4dc2-82a0-92d08b0f660b
$(Get-Item c:\scripts).lastaccesstime
It will check the last access time for the specified parent folder path.
Code below will list all the:
Folder and Sub folders plus last write time for each folder. (list folders only)
Get-ChildItem -Recurse "D:\powershell scripts" | ?{ $_.PSIsContainer } | Select-Object FullName,lastwritetime
Code below will list all the:
Files and folder plus last write time for each folder and files. (folders and files)
Get-ChildItem -Recurse -Path "D:\powershell scripts\" $_.PSIsContainer| Select-Object FullName, LastWriteTime
Below code will list all the:
Files in every folder, which includes LastwriteTime and its file name. (files only)
Get-ChildItem -Path "D:\powershell scripts" $_.LastWriteTime -Recurse
Folder name has space in between, need enclosed path in quotation marks.
List all directories display result in descriptive format:
Get-ChildItem "D:\powershell scripts\" -Recurse | where {$_.PSIsContainer -eq 'Directory'}
To when was the last time a file was modified or written, for example you have a document or a file that is shared and the file needs to be updated constantly. But you are not sure whether file is being updated or modified, PowerShell can help to check the file properties when was the last time it was written or modified.
(Get-item C:\Users\Administrator\WIP_Document\Sales_Doc_Input.docx).Lastwritetime
Sample output will be like this:
Friday, November 24, 2017 7:16:54 AM
Then you can always set a script and send the output to yourself or to anyone who should receive the email.
Cheers!!! Till next time!!!
==============================
Free Android Apps:
Divine Mercy Chaplet Guide:
https://play.google.com/store/apps/details?id=com.dmercyapp
Educational App for Android Kids:
https://play.google.com/store/apps/details?id=com.letsmultiply
Catholic Rosary Guide:
Android Divine Mercy Chaplet Guide
https://play.google.com/store/apps/details?id=com.dmercyapp
I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work
ReplyDeletebusiness directory Melbourne victoria