Sorting files into folders, according a portion of the file nameHow to sort files into folders, according to...

Digits in an algebraic irrational number

Why did other German political parties disband so fast when Hitler was appointed chancellor?

Traveling through the asteriod belt?

How to prevent cleaner from hanging my lock screen in Ubuntu 16.04

What are "industrial chops"?

Can I string the D&D Starter Set campaign into another module, keeping the same characters?

How to count the characters of jar files by wc

Difference between `vector<int> v;` and `vector<int> v = vector<int>();`

Does paint affect EMI ability of enclosure?

How to solve a large system of linear algebra?

CREATE ASSEMBLY System.DirectoryServices.AccountManagement.dll without enabling TRUSTWORTHY

One Half of Ten; A Riddle

Writing a character who is going through a civilizing process without overdoing it?

Explain the objections to these measures against human trafficking

Avoiding morning and evening handshakes

Can we use the stored gravitational potential energy of a building to produce power?

Publishing research using outdated methods

Why do neural networks need so many training examples to perform?

Intern applicant asking for compensation equivalent to that of permanent employee

How to limit sight distance to 1 km

Why did the villain in the first Men in Black movie care about Earth's Cockroaches?

Are there any modern advantages of a fire piston?

How to say "Brexit" in Latin?

Pronunciation of umlaut vowels in the history of German



Sorting files into folders, according a portion of the file name


How to sort files into folders, according to file names - Windows CMDHow to rename multiple folders while keeping their files subdirectoriesCombining same name pdf files together from different foldersBatch moving files from one folder to multiple folders based on file maskMoving files/folders to new structureBatch to move files from root folder into sub-foldersBatch Script for moving files to the same name folderCreating a Batch file to add JPG to MP3 to create AVI for all the files in a folderMove files into a folder based on their nameBatch Copy Multiple Files to Multiple FoldersBatch file to delete/remove folders old of xx days













0















I am looking to sort approximately 3,000 pdf files into their own folders. All 3,000 files are in one folder and follow the same format.



COURSE NAME - EMPLOYEEFIRSTNAME EMPLOYEELASTNAME



I have made all the folders, but now want to move the appropriate PDF document into the corresponding folder. but found this handy answer to get me started: How to sort files into folders, according to file names - Windows CMD.



This is what I'm currently trying to modify:



:: C:UsersUserDesktopTraining Test.cmd
@Echo off
PushD "C:UsersUserDesktopTraining Test"

For %%A in (*.pdf) do For /F "tokens=2,3delims=-." %%B in ("%%A") Do (
If Not exist "%%B" MD "%%B"
Move "%%A" "%%B"
)
PopD


What I'm finding is that it's creating a new folder with a space in front of the employee name. I have a folder named "EMPLOYEEFIRST EMPLOYEELAST", but its making a new folder of " EMPLOYEEFIRST EMPLOYEELAST" (note the space at the beginning).



I have also noticed that it creates a new folder for those employees with a hyphenated first or last name. EMPLOYEE-FIRST EMPLOYEE-LAST just turns into a new folder of " EMPLOYEE".



I'm very new to all of this. Is there a way of resolving the issues with the space in the folder name and hyphenated names?









share







New contributor




Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I am looking to sort approximately 3,000 pdf files into their own folders. All 3,000 files are in one folder and follow the same format.



    COURSE NAME - EMPLOYEEFIRSTNAME EMPLOYEELASTNAME



    I have made all the folders, but now want to move the appropriate PDF document into the corresponding folder. but found this handy answer to get me started: How to sort files into folders, according to file names - Windows CMD.



    This is what I'm currently trying to modify:



    :: C:UsersUserDesktopTraining Test.cmd
    @Echo off
    PushD "C:UsersUserDesktopTraining Test"

    For %%A in (*.pdf) do For /F "tokens=2,3delims=-." %%B in ("%%A") Do (
    If Not exist "%%B" MD "%%B"
    Move "%%A" "%%B"
    )
    PopD


    What I'm finding is that it's creating a new folder with a space in front of the employee name. I have a folder named "EMPLOYEEFIRST EMPLOYEELAST", but its making a new folder of " EMPLOYEEFIRST EMPLOYEELAST" (note the space at the beginning).



    I have also noticed that it creates a new folder for those employees with a hyphenated first or last name. EMPLOYEE-FIRST EMPLOYEE-LAST just turns into a new folder of " EMPLOYEE".



    I'm very new to all of this. Is there a way of resolving the issues with the space in the folder name and hyphenated names?









    share







    New contributor




    Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I am looking to sort approximately 3,000 pdf files into their own folders. All 3,000 files are in one folder and follow the same format.



      COURSE NAME - EMPLOYEEFIRSTNAME EMPLOYEELASTNAME



      I have made all the folders, but now want to move the appropriate PDF document into the corresponding folder. but found this handy answer to get me started: How to sort files into folders, according to file names - Windows CMD.



      This is what I'm currently trying to modify:



      :: C:UsersUserDesktopTraining Test.cmd
      @Echo off
      PushD "C:UsersUserDesktopTraining Test"

      For %%A in (*.pdf) do For /F "tokens=2,3delims=-." %%B in ("%%A") Do (
      If Not exist "%%B" MD "%%B"
      Move "%%A" "%%B"
      )
      PopD


      What I'm finding is that it's creating a new folder with a space in front of the employee name. I have a folder named "EMPLOYEEFIRST EMPLOYEELAST", but its making a new folder of " EMPLOYEEFIRST EMPLOYEELAST" (note the space at the beginning).



      I have also noticed that it creates a new folder for those employees with a hyphenated first or last name. EMPLOYEE-FIRST EMPLOYEE-LAST just turns into a new folder of " EMPLOYEE".



      I'm very new to all of this. Is there a way of resolving the issues with the space in the folder name and hyphenated names?









      share







      New contributor




      Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I am looking to sort approximately 3,000 pdf files into their own folders. All 3,000 files are in one folder and follow the same format.



      COURSE NAME - EMPLOYEEFIRSTNAME EMPLOYEELASTNAME



      I have made all the folders, but now want to move the appropriate PDF document into the corresponding folder. but found this handy answer to get me started: How to sort files into folders, according to file names - Windows CMD.



      This is what I'm currently trying to modify:



      :: C:UsersUserDesktopTraining Test.cmd
      @Echo off
      PushD "C:UsersUserDesktopTraining Test"

      For %%A in (*.pdf) do For /F "tokens=2,3delims=-." %%B in ("%%A") Do (
      If Not exist "%%B" MD "%%B"
      Move "%%A" "%%B"
      )
      PopD


      What I'm finding is that it's creating a new folder with a space in front of the employee name. I have a folder named "EMPLOYEEFIRST EMPLOYEELAST", but its making a new folder of " EMPLOYEEFIRST EMPLOYEELAST" (note the space at the beginning).



      I have also noticed that it creates a new folder for those employees with a hyphenated first or last name. EMPLOYEE-FIRST EMPLOYEE-LAST just turns into a new folder of " EMPLOYEE".



      I'm very new to all of this. Is there a way of resolving the issues with the space in the folder name and hyphenated names?







      batch





      share







      New contributor




      Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 mins ago









      Mickey Delo CanesMickey Delo Canes

      11




      11




      New contributor




      Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Mickey Delo Canes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Mickey Delo Canes is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410384%2fsorting-files-into-folders-according-a-portion-of-the-file-name%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Mickey Delo Canes is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Mickey Delo Canes is a new contributor. Be nice, and check out our Code of Conduct.













          Mickey Delo Canes is a new contributor. Be nice, and check out our Code of Conduct.












          Mickey Delo Canes is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410384%2fsorting-files-into-folders-according-a-portion-of-the-file-name%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...