Computing.Net > Forums > Disk Operating System > move and rename a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

move and rename a file

Reply to Message Icon

Name: Steve
Date: March 22, 2003 at 15:35:54 Pacific
OS: win 98
CPU/Ram: 266 128
Comment:

I am running windows 98 and wanted to create a batch file that would copy a text file from one directory to a backup directory on our server and rename the file to the current date at the same time. Any help would be much appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: RayMan
Date: March 24, 2003 at 13:26:26 Pacific
Reply:

Why wouldn't you use a backup command in windows?

But for DOS...

If it's the same file it can be hard coded into the command.

you'll need to map the network drive in win98 and create a batch file in the command window. /start/run/command

keep in mind that even though the command window displays directory structure with long names, the DOS shell will expect the "8chr.3chr" filename format, no spaces.

open the command window and type "help copy" for the syntax. You can choose to replace or append the destination file and that should assign a new file date.

I'll keep an eye on this thread.


0

Response Number 2
Name: Secret_Doom
Date: March 24, 2003 at 17:11:09 Pacific
Reply:

First, get the current date into a variable without separators, so it can be used as part of a filename:

FAQ #02 - Get date into a variable without separators

Then, use the variable, let's say %DATE%, to copy/rename the file. Example:

copy \\servername\location\file.txt c:\backupfolder\%DATE%.txt

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

_________________________________________________________________


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


hard disk failure after m... Copying files-date as a p...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: move and rename a file

copy or move and rename files www.computing.net/answers/dos/copy-or-move-and-rename-files/13772.html

Renaming a file with todays date www.computing.net/answers/dos/renaming-a-file-with-todays-date/14184.html

Rename a file to file with a secuential number? www.computing.net/answers/dos/rename-a-file-to-file-with-a-secuential-number/4799.html