DOS parameters

pts.
Tags:
Microsoft Windows
It's been a long time since I have used any DOS commands, but I think that there is a way to do what I want to do. I have downloaded a .csv file from the AS400 to a P.C. via client access using the RTOPCB command. That works fine. What I would like to do now is to create an archive directory and copy the .csv file to it for backup purposes. That is also no problem, but I want to name the file with the filename + the date. So if I copied newfile.csv, I would want to make a copy in the archive directory of newfile09142005.csv . I think I can do this with DOS parmeters. Can anyone help?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try the ren command to rename file. Type ren filename.csv filenamedate.csv at a command line prompt.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • This213
    Just a sec, let me get some of the cobwebs off this section of my brain: for /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do ( for /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do ( set %%a=%%j set %%b=%%k set %%c=%%l set hh=%%m set min=%%n ) ) set timestamp=%dd%%mm%%yy%%hh%%mm% echo Copying %1.csv to %1_%timestamp%.csv copy %1.csv %1_%timestamp%.csv I tried this with Win2k and it only somewhat works - that is, it refused to redefine the environment variables once set. Guess it's just been too long for me, but this should point you in the right direction. If you can, I'd recommend installing perl on the system, then you can use far more readable code: my $read_dir="C:pathtofiles"; my $backup_dir = "Z:pathtobackupfolder"; my $fname=''; my $ext=''; my $filecount=0; opendir(DIR, $read_dir) || die("Cannot open directory"); my @files= readdir(DIR); closedir(DIR); foreach my $f (@files){ unless( ($f eq ".") || ($f eq "..") || (-d $f) ){ $time = time(); if( $f =~ /^(.+).(.+)$/ ){ $fname = $1; $ext = $2; } $from = '"'.$read_dir.$f.'"'; $to = '"'.$backup_dir.$fname.'_'.$time.'.'.$ext.'"'; $err = `copy $from $to`; $filecount++; } } print "Copied $filecount Files From $read_dir To $backup_dirnn";
    0 pointsBadges:
    report
  • This213
    I see this isn't the place to post code, sorry it came out all fubar
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following