Windows 10: help with powershell 5.1 script for copying and moving folders and all their contents

Discus and support help with powershell 5.1 script for copying and moving folders and all their contents in Windows 10 Gaming to solve the problem; This is the script I wrote:$sources = Read-Host "Enter source folder paths comma-separated" $sourceList = $sources -split ',' $destinations =... Discussion in 'Windows 10 Gaming' started by Ryan Burton, Jun 3, 2024.

  1. help with powershell 5.1 script for copying and moving folders and all their contents


    This is the script I wrote:$sources = Read-Host "Enter source folder paths comma-separated" $sourceList = $sources -split ',' $destinations = @"E:\DestinationFolder1", "F:\DestinationFolder2", "W:\DestinationFolder3", "\\ServerName\SharedFolderDestination" foreach $source in $sourceList { foreach $destination in $destinations { Copy-Item -Path $source -Destination $destination -Recurse -Force } if test-path "M:\"{ move-item -Path $source -Destination $destination -recurse -force } } }What I need it to do is always read from the same folderandask at the b

    :)
     
    Ryan Burton, Jun 3, 2024
    #1
  2. SKC-PSI Win User

    Create a PowerShell script to create a copy

    I am trying to build a process to copy the folders and files on a folder on my computer. I want to create a script using PowerShell so that I can use it from Scheduler to do this consistently. I am unsure how to set up a script to allow this to happen.

    Any help is greatly appreciated.
     
    SKC-PSI, Jun 3, 2024
    #2
  3. Shaolys Win User
    Seeking Assistance with PowerShell Script for Automatic Handling of PDF Files

    Dear Microsoft Community,

    I hope this message finds you well.

    I'm reaching out to seek help and advice regarding a PowerShell script I've been working on. I'm relatively new to PowerShell scripting and I'm attempting to create a script that automates the process of moving PDF files from one location to another.

    Here's an overview of what the script should achieve:

    Objective: I want to create a script that continuously monitors a specific folder for new PDF files. Upon detecting a new PDF file, the script should automatically move it from the source folder to a designated destination folder.

    Script Details:

    1. The source folder is located at: D:\Downloads
    2. The destination folder is: F:\PDF_Files
    3. The script should perpetually monitor the source folder for new PDF files.
    4. When a new PDF file is created in the source folder, the script should initiate its move to the destination folder.
    Challenges: I've attempted to implement the script using the FileSystemWatcher class and event handling in PowerShell. However, I've encountered challenges in getting the script to function as intended. Despite my efforts, the script doesn't appear to be moving PDF files as desired.

    Request for Assistance: I kindly request assistance from the community to review and help troubleshoot my PowerShell script. If anyone has experience with similar scripts or insights into what might be causing the issue, your guidance would be greatly appreciated.

    Code Sample:

    Technical Implementation: In addition to seeking guidance on the script itself, I would greatly appreciate advice on how to deploy and run this script as a Windows service. I'm looking to ensure that the script runs continuously in the background, even after a system restart. Any assistance or resources on how to achieve this would be extremely helpful.

    Thank you in advance for your time and assistance.

    I look forward to your insights and suggestions.

    Best regards
     
    Shaolys, Jun 3, 2024
    #3
  4. help with powershell 5.1 script for copying and moving folders and all their contents

    Move a copy of unknown named images and rename - Powershell or Batch Script

    Current research across related stack exchange posts:

    1. SO - Copy first N files from source directory to “serialized” destination directory using powershell
    2. SF - Copy first 10 files from a folder and subfolders
    3. SO - Powershell to pick random files from a folder and move them to another folder
    4. SU - How to batch copy rename files
    5. SU - How to optionally copy and rename a file in Windows?
    6. SU - PowerShell Script to Rename - Copy - Move
    7. Bulk renaming of files in PowerShell with sequential numeric suffixes

    If I were to guess at a solution, based on the research as my coding skill are not very good, I think one of the solutions would look something like this:

    Powershell

    CMD

     
    Under A Tree, Jun 3, 2024
    #4
Thema:

help with powershell 5.1 script for copying and moving folders and all their contents

Loading...
  1. help with powershell 5.1 script for copying and moving folders and all their contents - Similar Threads - help powershell script

  2. PowerShell script help

    in Windows 10 Gaming
    PowerShell script help: Hello,I am trying to use PowerShell to edit similar file names examples below. no_25!2-2_FORSE_COMP.prnno_25!2-4_FORSE_COMP.prnno_25!2-9_FORSE_COMP.prnno_30!10-5_FORSE_COMP.prngb_10!01-_5_FORSE_COMP.prnno_30!11-3_FORSE_COMP.prnI need all the writing in upper case, the '!'...
  3. PowerShell script help

    in Windows 10 Software and Apps
    PowerShell script help: Hello,I am trying to use PowerShell to edit similar file names examples below. no_25!2-2_FORSE_COMP.prnno_25!2-4_FORSE_COMP.prnno_25!2-9_FORSE_COMP.prnno_30!10-5_FORSE_COMP.prngb_10!01-_5_FORSE_COMP.prnno_30!11-3_FORSE_COMP.prnI need all the writing in upper case, the '!'...
  4. PowerShell script help

    in Windows 10 Network and Sharing
    PowerShell script help: Hello,I am trying to use PowerShell to edit similar file names examples below. no_25!2-2_FORSE_COMP.prnno_25!2-4_FORSE_COMP.prnno_25!2-9_FORSE_COMP.prnno_30!10-5_FORSE_COMP.prngb_10!01-_5_FORSE_COMP.prnno_30!11-3_FORSE_COMP.prnI need all the writing in upper case, the '!'...
  5. help with powershell 5.1 script for copying and moving folders and all their contents

    in Windows 10 Software and Apps
    help with powershell 5.1 script for copying and moving folders and all their contents: This is the script I wrote:$sources = Read-Host "Enter source folder paths comma-separated" $sourceList = $sources -split ',' $destinations = @"E:\DestinationFolder1", "F:\DestinationFolder2", "W:\DestinationFolder3", "\\ServerName\SharedFolderDestination" foreach $source in...
  6. Move content from all subfolders to their parent folders

    in Windows 10 Network and Sharing
    Move content from all subfolders to their parent folders: Hi all,I have a drive with hundreds of folders in this fashion:e:/a/aa/any contente:/b/bb/any content...e:/z/zz/any contentI need the subfolders 1 per main folder, but maybe some have 2, kind of zz1 zz2 and its content files and/or folders, these need to be as they are now,...
  7. Move content from all subfolders to their parent folders

    in Windows 10 Gaming
    Move content from all subfolders to their parent folders: Hi all,I have a drive with hundreds of folders in this fashion:e:/a/aa/any contente:/b/bb/any content...e:/z/zz/any contentI need the subfolders 1 per main folder, but maybe some have 2, kind of zz1 zz2 and its content files and/or folders, these need to be as they are now,...
  8. Move content from all subfolders to their parent folders

    in Windows 10 Software and Apps
    Move content from all subfolders to their parent folders: Hi all,I have a drive with hundreds of folders in this fashion:e:/a/aa/any contente:/b/bb/any content...e:/z/zz/any contentI need the subfolders 1 per main folder, but maybe some have 2, kind of zz1 zz2 and its content files and/or folders, these need to be as they are now,...
  9. Copy multiple folders content to another folder

    in Windows 10 Ask Insider
    Copy multiple folders content to another folder: I need to copy the content of aprox 500 folders to another folder (I want to have all in the same folder). Is there any way to do it with a program or commands? I dont want to do it manually because it would take a lot of time. Thank you! submitted by /u/Armenthius [link]...
  10. PowerShell script to compress folder contents to cabinet file (.cab)

    in Windows 10 Software and Apps
    PowerShell script to compress folder contents to cabinet file (.cab): The script takes the contents of a folder (including all its subfolders) and creates a cabinet file (.cab), using the Windows native makecab.exe command. Get it here: Create-CAB.zip The script can be run, from either within PowerShell or from a shortcut (to find out how to...