Renaming files with date stamp (Windows)

From Initq

Jump to: navigation, search

This is how you would write a short script to rename file with current date/time stamp. This Batch process downloads a pgp file, decrypts it, uploads the file via ftp and then date/time stamps the encrypted and decrypted files and archives them.

This is our main batch file.
REM *** Create the date and time elements.
For /f "tokens=1-7 delims=:/-, " %%i in ('exit^|cmd /q /k"prompt $D $T"') do (
	For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
		set dow=%%i
		set %%a=%%j
		set %%b=%%k
		set %%c=%%l
		set hh=%%m
		set min=%%n
		set ss=%%o
	)
)

 
REM *** Copy file from Daks's FTP site to this directory for processing
ftp -s:ftp_down.txt

REM *** Decrypt the files
pgp --decrypt "D:\asp_clients\dak\cc_load\dak_card_rcbt_accttns.pgp" --passphrase "Apptricity1" --output "D:\asp_clients\dak\cc_load\dak.card_rcbt_accttxns"

REM *** Upload files to asp genesis.
ftp -s:ftp_up.txt

REM *** Copy data file to the Archive folder
move /Y dak_card_rcbt_accttns.pgp .\archived\dak_card_rcbt_accttns%yy%%mm%%dd%%hh%%min%.pgp
move /Y dak.card_rcbt_accttxns .\archived\dak.card_rcbt_accttxns%yy%%mm%%dd%%hh%%min%.txt
Copy of ftp_up.txt
open 192.168.170.98
ftpadmin
orange
cd apptricity_erm_361\apptricitybatch\interfaces\cc\
binary
prompt
mput dak.card_rcbt_accttxns
quit
Copy of ftp_down.txt
open 192.168.170.98
ftpadmin
orange
cd ftpdata
cd dak
cd wexcc_inbound
binary
prompt
mget *.pgp
mdelete *.pgp
quit
Personal tools