Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi. I just set up an FTP server for a friend who is going to use it to backup his business server onto his home system. The FTP client he is using allows for synchronization between the FTP server and a local folder. The only problem is that he wants a day-by-day backup of the folder. Does Windows (most likely the old DOS commands) have a function for making a new directory with the date as its name? For instance: MKDIR %date% or something similar? Than I could just write a batch script to back it up and run it every night, but I need that "date variable" if there is such a thing.

You don't need FTP, you need to setup a Virtual Private Network (VPN)
Here's a page on how:
http://www.onecomputerguy.com/networking/xp_vpn_server.htm
This way, you can map a network drive to the home computer, and this will make file transfer and scripting much easier!

Although a VPN would definitely be a viable alternative solution, the problem is not transfering the files, but copying them and moving them to a date labeled directory once they are on the hard drive.
Any help would be greatly appreciated... any help... at all... about anything... please?

Sorry it took so long... The reason that mkdir $(date +%Y%m%d) doesn't work is because the date is in the format yyyy/mm/dd and you can't have forward slashes (/) in the name of a file or folder.
Anyway, here is a batch file that works.
You'll need to setup the VPN and map a network drive to the backup folder on the home computer.
(if the following doesn't work because of line breaks, go to my website, send me an email, and I'll email the batch file to you.)REM Change d:\ to mapped network drive on the VPN
REM Path should end in \
set drive=d:\
for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
set Year=%%l
set Month=%%j
set Day=%%k
set Date=%%l-%%j-%%k\
)
set Path=%drive%%Date%
mkdir %Path%
REM Change c:\folder\* to the file or folder you wish to backup
REM duplicate the next line to copy multiple folders or files
c:\windows\system32\xcopy.exe /s c:\folder\* %Path%

You are my hero. I can't wait untill college so I can start devoting more of my time to this. I really appreciate the help!
Any help would be greatly appreciated... any help... at all... about anything... please?

![]() |
![]() |
![]() |

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