troubleshooting Question

Questions about move-item Powershell command

Avatar of donpick
donpick asked on
Powershell
6 Comments2 Solutions682 ViewsLast Modified:
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.


Questions:
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 ?
ASKER CERTIFIED SOLUTION
Aard Vark
Principal Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros