dcsimg
Results 1 to 5 of 5

Thread: How do I not merge the VB script in a folder.

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2018
    Posts
    13

    How do I not merge the VB script in a folder.

    Hi

    I have the following VB script that merges files and names them of which is fine. Trouble is that I also have the script of the .BAT command saved in X:\DOWNLOADS and when I merge the files it also merges it into the new subfolder

    Is there anyway I can merge but leave the .BAT command in X:\DOWNLOADS so that I can carry on merging files later.


    Code:
    @echo off
    setlocal EnableDelayedExpansion
    
    rem Define folder paths
    set BaseDir=X:\DOWNLOADS
    
    rem Quit if no files in download area to process
    set Empty=Y
    for %%A in ("%BaseDir%\*.*") do set Empty=N
    if "%Empty%" EQU "Y" (
        echo No new files to process, quitting.
        exit /b
    )
    
    rem Ask if BTP download to determine 
    set Download=
    choice /C YN /M "Is this a BTP download (Y/N)?"
    if !ERRORLEVEL! EQU 1 (
      set Download=BTP
    ) else (
      choice /C YN /M "IS THIS A CHILTERN DOWNLOAD(Y/N)?"
      if !ERRORLEVEL! EQU 1 (
        set Download=CHILTERN
      )
    )
    
    rem Prompt for reference number
    set RefNum=
    set /P "RefNum=Enter reference number (blank to exit):"
    
    rem If none entered, exit script
    if "%RefNum%" EQU "" exit /b
    
    rem Make a subfolder for the reference number
    md "%BaseDir%\%Download%%RefNum%"
    
    rem Move all files to new subfolder
    move "%BaseDir%\*.*" "%BaseDir%\%Download%%RefNum%"

  2. #2
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,154

    Re: How do I not merge the VB script in a folder.

    Add a test to see if the file name found is your .bat file and skip processing if it is.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2018
    Posts
    13

    Re: How do I not merge the VB script in a folder.

    Many thanks for that but vbs scripts etc is all completely new to me and unfortunately I not got a clue what you on about. Any chance you could explain idiot proof for me.

    Big thanks

  4. #4
    Hyperactive Member
    Join Date
    Nov 2017
    Posts
    372

    Re: How do I not merge the VB script in a folder.

    What you posted isn't a VBS script at all it is just a plain batch file. Did you write any part of the code you posted? Are you expecting someone to simply post updated code to do what you want? It is best to be honest up front, since if the assumption is that you are familiar with writing the code, the responses you get might just be general direction rather than actual code.

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2018
    Posts
    13

    Re: How do I not merge the VB script in a folder.

    I will be completely honest and say no I didnít write it and amended one off the internet. No I do not expect people just to write me a new one and post. What Iím looking for is guidance maybe through websites that you all know pointing me in right direction and I will amend as necessary and post on here again for people to just check.

    I sort of learning through the Robocopy app on the internet that you click on what you wanna do and it write it for you. I am not a lazy person and want to learn but it all above my head at mo unless I can do and then it auto writes script for me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width