WAAY off topic but need assistance - DOS/batch file

  • Transferring data exports to a backup folder. Want to create a backup folder based on current date. For the life of me I cannot get this to work:

    REM Transfer of nightly BFS data export to a dated folder

    REM Create a backup folder with today's date.

    @echo on

    c:

    cd c:\BFS_Backup

    Set foldername = %date:~10,4%-%date:~4,2%-%date:~7,2%

    mkdir %foldername%

    REM Move nighlty BFS data export text files to dated folder

    MOVE c:\BFS_Backup\*.txt c:\BFS_Backup\%foldername%

    It bombs at mkdir. It states The syntax of the command is incorrect. It doesn't make the folder. I can make any type of directory folders no problem.

    I am overlooking something..I know it

    thanks

  • The issue is you are missing the quotes...

    edit your statment to this:

    C:

    CD "C:\BFS_Backup"

    MKDIR "[/color]%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%"

    -

  • Jason greatly appreciated I was playing with this for over 2 hours yesterday...

    Now it works...

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply