Solved

Batch file copy and file rename

Posted on 2004-09-22
3
951 Views
Last Modified: 2010-04-14
I have a batch file that copies drawings from a file server to my HDD. See below.
copy j:\hal\synth\hsga\sheet?.dxf "c:\my documents\drawings"
This copies 4 sheets called SHEET1.DXF to SHEET4.DXF.
My question is: Is there a fairly simple routine I can add that will prompt me input a new file name to save it to without manually changing the name of each file. If I can do this in the same batch file that would be fine, or, I would really like help with a VB6 program to do the same. I could create the inteface, but would need some help with the code.
Thanks,

Jeff
0
Comment
Question by:fanguru1
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 12127060
You could try

------------------------------>8--------------------
set SRCMASK=%1
copy j:\hal\synth\hsga\%SRCMASK%?.dxf "c:\my documents\drawings"
------------------------------>8--------------------

and call the .bat like

mybat.bat SHEET
0
 
LVL 10

Expert Comment

by:Longbow
ID: 12127203
Hi,

What's the difference between sheet?.dxf and SHEET1.DXF ?
Will be the source and destination foldes always the same ?
0
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 500 total points
ID: 12127410
I'm trying to understand what you want do to.

You want to change the destination file name, like:
copy j:\hal\synth\hsga\sheet?.dxf "x:\<prompt for destination>"

Or you want to:
copy j:\hal\synth\hsga\sheet?.dxf "c:\my documents\drawings\<newfilename>.dxf"

I would simply include this in your script:

Set /p newfilename=Enter a new file name for the file

Then for whatever part of the copy command you want to substitute, use %newfilename% instead.  For example:

 j:\hal\synth\hsga\sheet?.dxf "c:\my documents\drawings\%newfilename%.dxf"
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now