Batch to get file name
Posted: 09 Aug 2010 01:45
Hi everyone.
Firstable I'll like to say sorry by my awful English.
Involved elements:
External USB hard disk
Windows 2003 Server R2 standar edition
Windows XP Professional SP3
Filezilla Server 0.9.33 beta
Blat 2.6.2
Directory monitor 1.0.1.23
What I do:
I have external hard disk connected to W2003 a shared. From XP I have a mapped this hard disk using UNC and this unit is for store files that people upload to FTP server.
I need make a bat that when new file start upload make these actions:
1.-Get file name
2.-Get folder name
3.-Send a email with this data (file and folder name) using Blat
4.-When upload finished send email using Blat to inform that this file is ready to start download
I've done so far:
Using Directory monitor detect that a new file is start upload and call a bat that send me an email using Blat with Folder name in a subject.
This code works:
@echo off
cd folderexample
for %%* in (.) do set var=%%~n*
for /f %%a in ('time/t') do set vartime=%%a
set body=-body "Test|Hello World"
set from=i@example.com
set to=example@example.com
set subj=-s "Test. FTP.%var%. New Files. %vartime%"
set server=-server smtp.example.com
set user=-u userexample
set pass= -pw passwordexample
C:\Bats\Blat\full\blat %0 -f %from% -b %to% %subj% %body% %server% %user% %pass%
Thanks in advance.
Firstable I'll like to say sorry by my awful English.
Involved elements:
External USB hard disk
Windows 2003 Server R2 standar edition
Windows XP Professional SP3
Filezilla Server 0.9.33 beta
Blat 2.6.2
Directory monitor 1.0.1.23
What I do:
I have external hard disk connected to W2003 a shared. From XP I have a mapped this hard disk using UNC and this unit is for store files that people upload to FTP server.
I need make a bat that when new file start upload make these actions:
1.-Get file name
2.-Get folder name
3.-Send a email with this data (file and folder name) using Blat
4.-When upload finished send email using Blat to inform that this file is ready to start download
I've done so far:
Using Directory monitor detect that a new file is start upload and call a bat that send me an email using Blat with Folder name in a subject.
This code works:
@echo off
cd folderexample
for %%* in (.) do set var=%%~n*
for /f %%a in ('time/t') do set vartime=%%a
set body=-body "Test|Hello World"
set from=i@example.com
set to=example@example.com
set subj=-s "Test. FTP.%var%. New Files. %vartime%"
set server=-server smtp.example.com
set user=-u userexample
set pass= -pw passwordexample
C:\Bats\Blat\full\blat %0 -f %from% -b %to% %subj% %body% %server% %user% %pass%
Thanks in advance.