Move-Item2?

Dec 28, 2015 at 10:06 PM
Hi,

I really appreciate all of the work you've put into this. One thing that I'm looking for easy access to is a cmdlet which would allow for moving files with the long filenames, such as you've already implemented for the remove-item2 cmdlet.

Any chance of having that in the next release? This would really make your module all the more useful for archiving.

If I've missed something and this feature is already there, my apologies.

Thanks,
Aaron
Coordinator
Jan 2, 2016 at 4:19 PM
Hi Aaron,

version 4.2 is released providing a Move-Item2 and Copy-Item2. I did not have the time to do proper testing. Can you do some tests, please?

Thanks,
Raimund
Jan 2, 2016 at 9:23 PM

I would love to. Btw, I haven't looked at gm for gci2, but I think psiscontainer property check didn't work in my script.

Is that expected or am I mistaken? Sorry, not near a computer at the moment.

From: raandree

Hi Aaron,

version 4.2 is released providing a Move-Item2 and Copy-Item2. I did not have the time to do proper testing. Can you do some tests, please?

Thanks,
Raimund

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Jan 3, 2016 at 1:55 PM
Right, Get-ChildItem2 returns [Alphaleonis.Win32.Filesystem.DirectoryInfo] or [Alphaleonis.Win32.Filesystem.FileInfo]. These objects do not have the PSIsContainer property and adding it would result in additional runtime.

Get-ChildItem2 provides a File and Directory switch. If this does not help, you can filter by the object type.

PS D:> $data = Get-ChildItem2 -Recurse
PS D:> $data.Count
707
PS D:> ($data | Where-Object { $_ -is [Alphaleonis.Win32.Filesystem.DirectoryInfo] }).Count
236

-Raimund
Jan 4, 2016 at 7:35 AM
Thank you! I'll use that property instead.

Yeah, I did some research on the Alphaleonis library when I downloaded your script, as I saw you made use of it for the long filenames. Very nice. I think you're the only one making use of it to write these needed basic file cmdlets to get around the .net limitations?

If so (well, either way, honestly), you're doing amazing work. I can't imagine a more urgent needs for admins. This will really bring powershell up to speed on performing tasks that would otherwise require log parser or robocopy (or any other non-.net coded file utility, i suppose).

I should be able to do some testing on the move commands tomorrow when I'm back in the office.

Feb 1, 2016 at 8:47 PM
For the Copy-Item2 command you have provided.. Are there plans to allow Recursive similiar to the native Copy-item?


Thanks!
Coordinator
Feb 9, 2016 at 2:06 PM
I am not sure why Copy-Item allows a non-recursive copy of a directory. IMHO this does not make sense.
Copy-Item -Path $SourcePath -Destination $DestinationPath
is the same like
mkdir $DestinationPath
Hence Copy-Item2 is always a recursive. Is it important to allow a non-recursive copy with Copy-Item2?
Feb 23, 2016 at 1:22 PM

From my perspective it is always nice to have toolsets that have flexibility. In Powershell 5.0 they have added the switch to allow the specification of “DEPTH” which I have utilized on a few instances. EX: I know I only define NTFS permissions on the top 3 Layers of my Folder structures. Beyond that it’s all set to inherit…. So if I do a recursive check of permissions I only want 3 levels.

Mitchell

Apr 25, 2016 at 2:54 PM
Congratulations for the module Raimund, I use it a lot and I think there is a problem with copy-item2 and force parameter it seems it doesn't work, when file exist in destination it throws a message that file already exist and doesn't rewrite it.