Solved

Batch file copy and file rename

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

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…
Multi-threading long-running processes can have a significant increase in overall performance and drastically decrease over time it takes for a process to complete. Unfortunately, not all applications support native multi-threading, some by design a…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 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