Solved

Batch file copy and file rename

Posted on 2004-09-22
3
952 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

914 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

14 Experts available now in Live!

Get 1:1 Help Now