Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Batch file copy and file rename

Posted on 2004-09-22
3
Medium Priority
?
960 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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…
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

609 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