2

I'm working on a large-scale unstructured data project in my org, and there's a number of very large volumes which need to be relocated that have thousands of folders (which are named 0000000 - 9999999 in random patterns), each containing thousands of small files. In order to spread the load, I've broken out the robocopy jobs into batches.

The issue I'm running into is this: When I create the commands (in Excel, pasted into Notepad++ for delimiter removal, then pasted again into CMD or PowerShell) I have leading zeros in front of the folder names. Further investigation has revealed that this happens with plain text as well.

Nothing I've tried as far as changing cell types, looking for hidden characters, etc. has resolved the issue. See posits below for detail, but I've pretty much narrowed this down to an issue with the terminal application.

Couple of other posits to note:

  • The only way that I've found that it works correctly is when I paste the data into the standalone Windows PowerShell pasted into standalone WPS

NO standalone CMD pasted into standalone CMD

NO standalone PowerShell 7 pasted into standalone PowerShell 7

NO Terminal app CMD pasted into Terminal CMD

NO Terminal app PowerShell 7 pasted into Terminal PowerShell 7

NO Terminal app Windows PowerShell pasted into Terminal WPS

  • I've ruled out issues with keyboard layout, language, etc with my workstation by trying these operations directly from the console of a separate server.
  • It's not an issue with Notepad++. I've tried a number of different text editors, and also Word.
  • It does not happen when I generate the text manually... i.e. typing it out in a notepad and pasting it.
  • The paste appears correctly when I place the data into any other application... it's only in the terminal applications.

In my 30 years of sysadmin work, I've never come across this issue. I can work around it by using the standalone Windows PowerShell, but this is a real head-scratcher that I'd like to resolve if I can. I'm a little hesitant to get Microsoft Support engaged on it since it'll likely be a lot of shuffling around before getting to "it's a known issue and we don't have a resolution at this time." like I said, I've got a mountain of work to do to get all this data relocated and I'd prefer to use the tabbed Windows Terminal console, so I thought I'd throw it out there to you fine people and see if anyone has experienced it.

2
  • Please edit the question and add more info: output from hexdump -C (no file; instead, paste problematic string into the standard input and press Enter, then press Ctrl+C). FYI, you can download hexdump from di-mgt.com.au/hexdump-for-windows.html Commented Jun 9 at 12:06
  • You said "leading zeros," but from your pictures, it appears you actually mean "leading spaces"? In any case, I would recommend writing a script rather than copying and pasting manually. Manual copy-and-paste is going to be error-prone no matter whether there are leading spaces (or zeros) or not. Commented Jun 18 at 18:44

1 Answer 1

1

You're creating the commands by pasting strings into Excel and munging them in Notepad++. This is not great, as you're finding.

You would do better to use a scripting language. You're already using Powershell as a console; it's a full-featured scripting language as well. You can easily put your folder names into an array and append/transform as needed; using Join-Path instead of simple string concatenations should do a lot to improve delimiter handling (slashes).

30 years experience as a sysadmin: this is definitely a good time to learn the force-multiplication that scripting can give you.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.