Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Windows XP

Windows XP Discuss the Microsoft Windows XP Operating System

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 01-04-2007, 03:35 AM
SANDY
Newsgroup Contributor
 
Posts: n/a
how to execute batch file automatically when file is added in folder

hi all
can some guide me how to execute a batch file automatically when i
upload a file in that folder from ftp
i am not that good at programming , have some idea about batch files so
basically wanted to excutea batch file i made when there is a new file
in that folder,

thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 01-04-2007, 03:35 AM
  #2 (permalink)  
Old 01-04-2007, 03:35 AM
Pegasus \(MVP\)
Newsgroup Contributor
 
Posts: n/a
Re: how to execute batch file automatically when file is added in folder


"SANDY" <hugsandy******.com> wrote in message
news:1162402727.957037.238690@f16g2000cwb.googlegr oups.com...
> hi all
> can some guide me how to execute a batch file automatically when i
> upload a file in that folder from ftp
> i am not that good at programming , have some idea about batch files so
> basically wanted to excutea batch file i made when there is a new file
> in that folder,
>
> thanks
>


You could use the Task Scheduler to launch this batch file once
every five minutes:

@echo off
if not exist c:\OldDir.txt echo. > c:\OldDir.txt
dir /b "d:\My Folder" > c:\NewDir.txt
set equal=no
fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set
equal=yes
copy /y c:\Newdir.txt c:\OldDir.txt > nul
if %equal%==yes goto :eof
rem Your batch file lines go here


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 01-04-2007, 03:36 AM
SANDY
Newsgroup Contributor
 
Posts: n/a
Re: how to execute batch file automatically when file is added in folder

Hi

thanks
few quries i was trying to make it work
i guess what we are trying to do is set a envoirment variable right?
i tried to execute the script as it is but it gave error device not
ready then i saw there was path
dir /b "d:\My Folder" > c:\NewDir.txt

I changed it to
dir /c "d:\My Folder" > c:\NewDir.txt
now My folder is the folder i guess i need to monitor correct ?

but in the set equal=no does not seem to work as i see my environment
variables instead of the command setting a varibale eqaul=no

will keep trying diff combinations and update later

thanks
sandy

Pegasus (MVP) wrote:
> "SANDY" <hugsandy******.com> wrote in message
> news:1162402727.957037.238690@f16g2000cwb.googlegr oups.com...
> > hi all
> > can some guide me how to execute a batch file automatically when i
> > upload a file in that folder from ftp
> > i am not that good at programming , have some idea about batch files so
> > basically wanted to execute a batch file i made when there is a new file
> > in that folder,
> >
> > thanks
> >

>
> You could use the Task Scheduler to launch this batch file once
> every five minutes:
>
> @echo off
> if not exist c:\OldDir.txt echo. > c:\OldDir.txt
> dir /b "d:\My Folder" > c:\NewDir.txt
> set equal=no
> fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set
> equal=yes
> copy /y c:\Newdir.txt c:\OldDir.txt > nul
> if %equal%==yes goto :eof
> rem Your batch file lines go here


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 01-04-2007, 03:36 AM
Pegasus \(MVP\)
Newsgroup Contributor
 
Posts: n/a
Re: how to execute batch file automatically when file is added in folder

Your newsreader broke up the lines and you did not restore
them correctly. Here is a numbered version:

Line1 @echo off
Line2 if not exist c:\OldDir.txt echo. > c:\OldDir.txt
Line3 dir /b "d:\My Folder" > c:\NewDir.txt
Line4 set equal=no
Line5 fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set
equal=yes
Line5 copy /y c:\Newdir.txt c:\OldDir.txt > nul
Line6 if %equal%==yes goto :eof
Line7 rem Your batch file lines go here

I cannot tell you what "d:My Folder" should be. It's your
machine you're dealing with and only you know which
folder you wish to examine!


"SANDY" <hugsandy******.com> wrote in message
news:1162466412.040243.212080@i42g2000cwa.googlegr oups.com...
> Hi
>
> thanks
> few quries i was trying to make it work
> i guess what we are trying to do is set a envoirment variable right?
> i tried to execute the script as it is but it gave error device not
> ready then i saw there was path
> dir /b "d:\My Folder" > c:\NewDir.txt
>
> I changed it to
> dir /c "d:\My Folder" > c:\NewDir.txt
> now My folder is the folder i guess i need to monitor correct ?
>
> but in the set equal=no does not seem to work as i see my environment
> variables instead of the command setting a varibale eqaul=no
>
> will keep trying diff combinations and update later
>
> thanks
> sandy
>
> Pegasus (MVP) wrote:
> > "SANDY" <hugsandy******.com> wrote in message
> > news:1162402727.957037.238690@f16g2000cwb.googlegr oups.com...
> > > hi all
> > > can some guide me how to execute a batch file automatically when i
> > > upload a file in that folder from ftp
> > > i am not that good at programming , have some idea about batch files

so
> > > basically wanted to execute a batch file i made when there is a new

file
> > > in that folder,
> > >
> > > thanks
> > >

> >
> > You could use the Task Scheduler to launch this batch file once
> > every five minutes:
> >
> > @echo off
> > if not exist c:\OldDir.txt echo. > c:\OldDir.txt
> > dir /b "d:\My Folder" > c:\NewDir.txt
> > set equal=no
> > fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set
> > equal=yes
> > copy /y c:\Newdir.txt c:\OldDir.txt > nul
> > if %equal%==yes goto :eof
> > rem Your batch file lines go here

>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 01-04-2007, 03:48 AM
SANDY
Newsgroup Contributor
 
Posts: n/a
Re: how to execute batch file automatically when file is added in folder

Thanks Boss
ur script also solve a question i had before how to compare files and
use result as option for next thing :)

SANDY

Pegasus (MVP) wrote:
> Your newsreader broke up the lines and you did not restore
> them correctly. Here is a numbered version:
>
> Line1 @echo off
> Line2 if not exist c:\OldDir.txt echo. > c:\OldDir.txt
> Line3 dir /b "d:\My Folder" > c:\NewDir.txt
> Line4 set equal=no
> Line5 fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set
> equal=yes
> Line5 copy /y c:\Newdir.txt c:\OldDir.txt > nul
> Line6 if %equal%==yes goto :eof
> Line7 rem Your batch file lines go here
>
> I cannot tell you what "d:My Folder" should be. It's your
> machine you're dealing with and only you know which
> folder you wish to examine!
>
>
> "SANDY" <hugsandy******.com> wrote in message
> news:1162466412.040243.212080@i42g2000cwa.googlegr oups.com...
> > Hi
> >
> > thanks
> > few quries i was trying to make it work
> > i guess what we are trying to do is set a envoirment variable right?
> > i tried to execute the script as it is but it gave error device not
> > ready then i saw there was path
> > dir /b "d:\My Folder" > c:\NewDir.txt
> >
> > I changed it to
> > dir /c "d:\My Folder" > c:\NewDir.txt
> > now My folder is the folder i guess i need to monitor correct ?
> >
> > but in the set equal=no does not seem to work as i see my environment
> > variables instead of the command setting a varibale eqaul=no
> >
> > will keep trying diff combinations and update later
> >
> > thanks
> > sandy
> >
> > Pegasus (MVP) wrote:
> > > "SANDY" <hugsandy******.com> wrote in message
> > > news:1162402727.957037.238690@f16g2000cwb.googlegr oups.com...
> > > > hi all
> > > > can some guide me how to execute a batch file automatically when i
> > > > upload a file in that folder from ftp
> > > > i am not that good at programming , have some idea about batch files

> so
> > > > basically wanted to execute a batch file i made when there is a new

> file
> > > > in that folder,
> > > >
> > > > thanks
> > > >
> > >
> > > You could use the Task Scheduler to launch this batch file once
> > > every five minutes:
> > >
> > > @echo off
> > > if not exist c:\OldDir.txt echo. > c:\OldDir.txt
> > > dir /b "d:\My Folder" > c:\NewDir.txt
> > > set equal=no
> > > fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set
> > > equal=yes
> > > copy /y c:\Newdir.txt c:\OldDir.txt > nul
> > > if %equal%==yes goto :eof
> > > rem Your batch file lines go here

> >


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute batch file regardless the operating system happytoday Windows XP 14 05-31-2008 06:50 PM
How to execute a batch file on startup? void.no.spam.com@gmail.com Windows Vista 2 05-25-2008 09:40 PM
Can't execute batch file without extension zhongsheng Windows XP 7 02-20-2008 01:40 PM
can a file be added to a folder while the folder is hidden? wayne glover Windows XP 3 04-06-2007 07:45 PM
How To Execute Batch File Line By Line RitaG Windows XP 4 03-22-2007 06:46 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 02:30 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0