1
I'm trying to move files using robocopy to NULL in a powershell script, in effect deleting them. Normally I'd use get-childitem but I'm dealing with long file name paths and it fails on those, but robocopy won't. For some reason powershell is interpreting NULL as a folder it needs to create instead of copying it to the NULL device. Googling led me to think this is possible, but everywhere I saw people using NULL in the same way I'm trying to but were using it to find files matching a string, instead of moving the files. This is the part of the script that does the moving:
robocopy $directory NULL *.* /xf *.pst /e /mov
Anyone have any luck using robocopy to move files to NULL? Or is there a better way to do this?
Where did you see people using
NULL
like that? I think the null device in PowerShell is$NULL
. – Dour High Arch – 2017-12-19T14:45:42.400It is
NUL
with oneL
. And no you cannot use it like /DEV/NULL in the Unix world. – Squashman – 2018-12-13T00:16:47.097