issue with this ftp script

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

issue with this ftp script

Postposted on 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...

Code: Select all
@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% 
stuckne1
Gerbil
 
Posts: 48
Joined: Thu Oct 04, 2007 4:10 pm

Re: issue with this ftp script

Postposted on 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 :(
morphine
Gerbil Khan
Silver subscriber
 
 
Posts: 9980
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Re: issue with this ftp script

Postposted on Tue Jan 10, 2012 10:07 am

Thanks, that worked! =)

New Code.

Code: Select all
@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%"
stuckne1
Gerbil
 
Posts: 48
Joined: Thu Oct 04, 2007 4:10 pm


Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 0 guests