Personal computing discussed

Moderators: SecretSquirrel, just brew it!

 
stuckne1
Gerbil
Topic Author
Posts: 48
Joined: Thu Oct 04, 2007 4:10 pm

issue with this ftp script

Tue Jan 10, 2012 9:34 am

So this script almost works perfectly except for the folder name... I look in the folder and instead of a having a folder "Mon 1/10/2012" I have several folders inside of each other. I have a folder "Mon 01" with an "10" folder inside with a "2012" folder inside...

Any ideas on why this may be greatly appreciated...

@echo OFF

REM INSTRUCTIONS

REM 1. Set the ftpascii value to a temp file name (used to store ftp commands to be run at the end of the script)
REM 2. Set destinationDir to the directory you want to change to once you connect to the ftp server

REM 3. Replace ftp.server.com with your ftp server
REM 4. Replace username with your username
REM 5. Replace password with your password

REM 6. Replace the 'commandhere' with the appropriate ftp command (make as many lines as you need)

@echo

set ftpascii="ftpascii.txt"
set destinationDir=/install_main/
set "newFolder=%DATE%"

REM Build the ftp script.
REM We don't leave a space between the value & the > symbol because that space would be sent to the file

echo open dev1.eshipmanager.com> %ftpascii%
echo dev_coldfusion>> %ftpascii%
echo c0ldfus10n>> %ftpascii%
echo cd %destinationDir%>> %ftpascii%
echo mkdir %newFolder%>> %ftpascii%
echo quit>> %ftpascii%
REM -----------------------------------

ftp -s:%ftpascii% 
 
morphine
Silver subscriber
Gerbilus Supremus
Posts: 11182
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Re: issue with this ftp script

Tue Jan 10, 2012 9:51 am

That'll be because "/" is a path divider in Unix. Replace the forward slashes with another character (I suggest underscore or dot), and you should be fine.
There is a fixed amount of intelligence on the planet, and the population keeps growing :(
 
stuckne1
Gerbil
Topic Author
Posts: 48
Joined: Thu Oct 04, 2007 4:10 pm

Re: issue with this ftp script

Tue Jan 10, 2012 10:07 am

Thanks, that worked! =)

New Code.

@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @( 
   Set Month=%%A
   Set Day=%%B
   Set Year=%%C
)

set "newFolder=%Month%_%Day%_%Year%"

Who is online

Users browsing this forum: No registered users and 2 guests