Sharing with you a simple Powershell script I wrote and use to list all the files names and location information for a given folder and then easily copy that TXT file between other folders in the same server.
E.g:- list all files inside myFolderA and export this info to myFile.txt
This will not copy files between remote servers. That requires a more complex method using Invoke-command and remote powershell authentication
To list content of folder
Get-ChildItem K:\myfolderA\*.*| Set-Content K:\myfolderA\myfile.txt
To copy into myFolderB
$From = "K:\myfolderA\myfile.txt"
Copy-Item -Path $From -Destination "J:\myfolderB\newMyfile.txt" -Recurse -Force
$From = This will be the full path of the file you want to copy
Destination – This will be the destination drive and folder for your copied file
Published by Josh U
Welcome to my blog. A little about me - I am very passionate about Information Technology IT, Cloud, AI, Data-centers. I enjoy building mini servers from scratch and assembling the different parts, rams, motherboards, fans, power units, storage drives, and installing the OS, Asic miners, NFTs. I hold a Bachelor and Masters degree in Information Technology. I'm currently working as an Infrastructure Specialist across different cloud technologies.
The information in this blog is all on my personal opinion and from experience and hours of self practice, and nothing to do with any Company I work for or might have worked for in the past. Please If you have any comments and suggestions or anything you would like to bring to my attention, kindly let me know, remember, no one is perfect. Thank you for your visit.
View all posts by Josh U