Help in moving files within a script.

August 8, 2018 at 11:23:16
Specs: Windows 7
Hi I have the following script but im trying to arrange to move the completed folder once merged and named from C:\downloads into C :/downloads1 and if it a BTP download also I need it to open the folder C:\downloads1 and then a message box or something to appear stating to add btp statement and 7zip file.

Can anyone help on the best way I can do that.

Script below

echo off
setlocal EnableDelayedExpansion

rem Define folder paths
set BaseDir=c:\DOWNLOADS

rem Quit if no files in download area to process
rem (excluding the batch file)
dir /b "%BaseDir%\*" 2>nul | find /v "%~nx1" >nul || (
    echo No new files to process, quitting.
    exit /b
)

rem Ask which download type 
set Download=
choice /c BC /M "(B)TP or (C)hiltern download?"
 
if errorlevel 1 set Download=BTP
if errorlevel 2 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
attrib +h %~F1
move "%BaseDir%\*.*" "%BaseDir%\%Download%%RefNum%"
attrib -h %~F1

Thanks


See More: Help in moving files within a script.

Reply ↓  Report •

#1
August 30, 2018 at 08:28:40
I've been on vacation and unable to reply to post here.
Just noticed this post as being unanswered.
Did you get any further on your own?

So do you still need help?

i5-6600K[delid]@4.8GHz/4.3GHz@1.4v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2700MHz@1.35v
MSI Armor RX 570 4GB@1340Mhz core@1.110v/1865MHz BiosModded


Reply ↓  Report •

#2
August 30, 2018 at 08:40:34
If you could help it would be a great great help. Thanks

Reply ↓  Report •

#3
September 4, 2018 at 01:01:23
I've got some time today, ill clear up your code a little

i5-6600K[delid]@4.8GHz/4.3GHz@1.4v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2700MHz@1.35v
MSI Armor RX 570 4GB@1340Mhz core@1.110v/1865MHz BiosModded


Reply ↓  Report •

Related Solutions

#4
September 4, 2018 at 02:28:28
I kind of didn't read the entire request, I only fixed some syntax error's & added some comments.

also i have not tested the code, so please do a backup

i5-6600K[delid]@4.8GHz/4.3GHz@1.4v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2700MHz@1.35v
MSI Armor RX 570 4GB@1340Mhz core@1.110v/1865MHz BiosModded


Reply ↓  Report •

#5
September 4, 2018 at 04:13:36
Amended what I posted??

Reply ↓  Report •

#6
September 4, 2018 at 04:39:07
oh sorry, i forgot to paste the code;


@echo off&setlocal EnableDelayedExpansion
rem Define folder paths
set BaseDir=C:\DOWNLOADS
rem Quit if no files in download area to process
rem (excluding the batch file)
cd "%basedir%"
::filter out the directories, & skip this file.
for /f "tokens=* delims= " %%a in ('dir/b/A-D ^| find /v "%~nx0"') do (
if "%%a"=="" (
echo No new files to process, quitting.&pause>nul
exit /b
)
)
rem Ask which download type
set /p Download=
choice /c bc /M "(B)TP or (C)hiltern download?"
if !errorlevel!==1 set Download=BTP
if !errorlevel!==2 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%"=="" exit /b
rem Make a subfolder for the reference number
md "%BaseDir%\%Download%\%RefNum%"
rem Move all files to new subfolder
::replacing *.* with * will also move downloaded folders
for /f "tokens=* delims= " %%a in ('dir/b ^| find /v "%~nx0"') do (
if "%%a"=="" (
echo No new files to process, quitting.&pause>nul
exit /b
) else (
move "%BaseDir%\*.*" "%BaseDir%\%Download%\%RefNum%"
)
)

i5-6600K[delid]@4.8GHz/4.3GHz@1.4v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2700MHz@1.35v
MSI Armor RX 570 4GB@1340Mhz core@1.110v/1865MHz BiosModded


Reply ↓  Report •

#7
September 4, 2018 at 05:31:38
Brill big big thanks

Reply ↓  Report •

Ask Question