Solved

Batch file copy and file rename

Posted on 2004-09-22
3
955 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 96

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook 2013 Certicate error 1 305
Windows 16 363
Cannot Upgrade Microsoft Installer on Windows 2000 29 75
Can’t delete a file 14 225
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…
Not everyone has adapted to a rapid advancement in technology; there are people who are reluctant or afraid to delve into this brave new world of IT. If you have a friend or a family member who suffers from the so-called technophobia, here is how yo…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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