Each Month I receive a group of 144 files (representing a location summary) each in it’s own sub folder. So I receive access to a Subfolder titled 0223 (for February 2023) , then there are the 144 sub folders (named after each location , 800, 801, 802, 803, etc. Each of the files has a standard name such as: Invoice_summary.csv, ap_summary, and comission_summary. The names never change and each location always has the three same files.
I want to add the location name as a prefix to each file so the files would look like this:
800_invoice_summary, 800_ap_summary, and 800_commision_summary (for all 144 folders) What would be thecode used for PowerShell? can this be written to ensure all files are renamed without hard coding each folder?
This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.
We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.
Yes, of course I am new to this and here is
Get - childitem *.csv | Rename -Item - Path “J:\NEW CASH RECEIPTS RECORD\CALENDAR YEAR 2023 DAILY CASH REPORT\BACK UP FOR SITES\Gingr Manual Reports- Accrual\0123\821\invoice_charge_summary.csv” -NewName “820_invoice_charge _summary.csv”
For new names (144 files) how do force the folder name for all 144 items do I have tp combine the "Get -childitem with a wide card??
When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.