HPE GreenLake Administration
Operating System - Microsoft
        1839917
        Members
    
    
        3079
        Online
    
    
        110157
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
	
		
			
            
                
            Go to solution
        
            
		
		
			
            	
	
		
        
		
	
	
		Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2006 11:57 PM
08-24-2006 11:57 PM
			
				
					
					
						I have a .bat file on a Windows XP Pro platform that will FTP a file to another server.  I would like to know how to rename the file by appending the current date to the filename before the put command.
Here is what I am doing/want to do:
OPEN server
dwftp
*****
lcd \\server\targetdir
status
PUT CURRDATA.txt CURRDATA_08252006.txt
bye
So, I need to put the date in a variable and append the variable to the filename somehow. I don't want to have to edit the .bat daily to change the date. The .bat file will run automatically each evening.
Thank you.
Sue
					
				
			
			
				
			
			
				
	
			
				
		
			
			
			
			
			
			
		
		
		
	
	
	
Here is what I am doing/want to do:
OPEN server
dwftp
*****
lcd \\server\targetdir
status
PUT CURRDATA.txt CURRDATA_08252006.txt
bye
So, I need to put the date in a variable and append the variable to the filename somehow. I don't want to have to edit the .bat daily to change the date. The .bat file will run automatically each evening.
Thank you.
Sue
Solved! Go to Solution.
		1 REPLY 1
	
	            
            
		
		
			
            
                - Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2006 04:14 AM
08-25-2006 04:14 AM
Solution
			
				
					
					
						Try this:
------------------------------------------
rem .: if your date has '/' in the date, they need to be stripped out.
for /f "delims='/'" %%i in ('%date%') do
set my_date=%%i%%j%%k
set my_file=CURRDATA%my_date%.txt
OPEN server
dwftp
lcd \\server\targetdir
status
PUT CURRDATA.txt %my_file%
bye
-------------------------------------------
If you need to use a script file to run rather than issue the commands directly, you can echo the commands out to a file like below:
---------------------------------------
set /P my_loc="Please enter FTP site: "
set /P my_id="Please enter your ID: "
set /P my_pass="Please enter your Password: "
echo open %my_loc% > ftp_conn.txt
echo user %my_id% %my_pass%>> ftp_conn.txt
echo binary >> ftp_conn.txt
echo hash >> ftp_conn.txt
echo put %my_date%.zip >> ftp_conn.txt
echo close >> ftp_conn.txt
echo quit >> ftp_conn.txt
ftp -s:ftp_conn.txt
del ftp_conn.txt
del %my_date%.zip
--------------------------------------------
Jon
		
		
	
	
	
------------------------------------------
rem .: if your date has '/' in the date, they need to be stripped out.
for /f "delims='/'" %%i in ('%date%') do
set my_date=%%i%%j%%k
set my_file=CURRDATA%my_date%.txt
OPEN server
dwftp
lcd \\server\targetdir
status
PUT CURRDATA.txt %my_file%
bye
-------------------------------------------
If you need to use a script file to run rather than issue the commands directly, you can echo the commands out to a file like below:
---------------------------------------
set /P my_loc="Please enter FTP site: "
set /P my_id="Please enter your ID: "
set /P my_pass="Please enter your Password: "
echo open %my_loc% > ftp_conn.txt
echo user %my_id% %my_pass%>> ftp_conn.txt
echo binary >> ftp_conn.txt
echo hash >> ftp_conn.txt
echo put %my_date%.zip >> ftp_conn.txt
echo close >> ftp_conn.txt
echo quit >> ftp_conn.txt
ftp -s:ftp_conn.txt
del ftp_conn.txt
del %my_date%.zip
--------------------------------------------
Jon
	"Do or do not.  There is no try!" - Yoda
			
			
				
			
			
			
			
			
			
		The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP
