I am finding more and more things I can do with PowerShell everyday. The other day, I had to “touch” a file… one line is what it takes:
(ls testFile.txt).LastWriteTime = New-object DateTime 1991,12,31
To list available contexts: kubectl config get-contexts To show the current context: kubectl config current-context…
kubectl exec -it <podname> -- sh To get a list of running pods in the…
# Create a soft symbolic link from /mnt/original (file or folder) to ~/link ln -s…
git config --global user.name "<your name>" git config --global user.email "<youremail@somewhere.com>" Related Commands Show current…
TypeScript/JavaScript function getLastMonday(d: Date) { let d1 = new Date(d.getFullYear(), d.getMonth() + 1, 0); let…
I had to do some SMTP relay troubleshooting and it wasn't obvious how to view…
View Comments
(ls testFile.txt).LastWriteTime = Get-Date
Thanks for the tip, D. If we go with the standard definition of "touch" - to change the file modification time to the current time - then your version is definitely shorter. When I was doing this, I had a need to use a specific time.