Batch file with Variable directory Paths

I have simple move command that I need to make into a batch file.

move "\company-nas\local\Shared\Sites\Property_A\Directory A" "\company-nas\local\Shared\Sites\Property_A\Directory B"

My issue is the Property_A is variable. So the next copy would be Property_B. So on and so forth. How can I make this into a batch script?
LVL 1
Vontech615Asked:
Who is Participating?
 
pony10usConnect With a Mentor Commented:
Try this:

@echo off
set /p Property_ID= What is the name of the property?
move "\company-nas\local\Shared\Sites\Property_A\Directory A" "\company-nas\local\Shared\Sites\%Property_ID%\Directory B"

Open in new window

0
 
x-menIT super heroCommented:
use "robocopy.exe" to copy folder and subfolder.
You can filter files, and schedule jobs.

more at:
http://technet.microsoft.com/en-us/library/cc733145.aspx
0
 
Vontech615Author Commented:
Yes but the source and destination path's change. I've used robocopy before with the FOR command but not with variable paths.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Vontech615Author Commented:
Basically, I need to know if my script can be 1 line or if I'm going to have to add a line for each Property name (Property_A, B, C, D, etc.)
0
 
remmett70Commented:
Is there some type of logic to know what the next Property value will be?
0
 
Vontech615Author Commented:
No not really. They are alphabetical obviously but Names like ARP Manor, Bailey Lane, Cambridge, etc. etc.
0
 
pony10usCommented:
Will this be run manually?  If so then you could have the batch file ask for the property name as input.
0
 
Vontech615Author Commented:
I could run it manually, yes.
0
 
remmett70Commented:
Once Property_A\Directory_A is moved to Property_A\Directory_B, will the script ever need to do a another move of the same Property_A folder again?  If not, could create a log file to record what folders have been done.
0
 
Vontech615Author Commented:
That method works and should come in handy with other projects.  Thanks for the input.

Just fyi.  I had worked with someone else on this and ended up with this...

@echo
setlocal

for /f "tokens=*" %%a in ('dir /b /ad "\\company-nas\local\Shared\Sites\*" ') do (Move "\\company-nas\local\Shared\Sites\%%a\AR File Checks" ^
  "\\company-nas\local\Shared\Sites\%%a\Compliance")

Open in new window


This also works.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.