Questions about move-item Powershell command
Posted on 2016-09-24
Running Powershell v4 on Windows 7 pro.
I am a Powershell novice. I want to move files from directory A to directory B. If the file already exists in directory B then the file is not to be moved.
So the first thing I would do is to start Powershell and change to directory A
cd \”directory A”
Then execute :
Get-Childitem -Path “.” -Recurse | move-item -Destination “directory B”
The “.” represents directory A. Quotes surround “directory B” because the directory name may have a space in it.
1.) Before I execute this command and possibly corrupt or destroy data, does the command look correct ? What would you change?
2.) My understanding is parameters can be fed to a Powershell script. What commands in Powershell would you use to feed the source and destination directories to a move-item command?
3.) Once the move-item command is put into a .ps1 file, how do I schedule this Powershell file? May be you might have an example you could share?
4.) My understanding is before a Powershell ps1 file can be executed some sort of permissions must be changed? What must be done to set the permissions ?