Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: Special batchfile

Reply
Thread Tools Display Modes

Re: Special batchfile

 
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      12-16-2008

"stevenjansen" <> wrote in message
news:...
>
> Hello,
>
> Who can make a batchfile with de following tasks:
>
> - A program on my computer will open the batchfile
> - The batchfile wil sleep "X" seconds
> - After sleeping the batchfile will rename a other file that stay in
> the same map of de batchfile.
>
> De name of that file must be: movie_1_YYYYMMDD_HHMMSS.wmv
> YYYYMMDD refert to de date of the moment that de batchfile is running
> HHMMSS refert to de time of the moment that de batchfile is running
>
> (Example: When i run the batch file on 2008-12-16 and on time 16:02:57,
> the name of the file that must be renamed is:
> movie_1_20081206_160257.wmv and must be renamed in movie.wmv)
>
> De file must be renamed to "movie.wmv".
> After renaming the fill must be uploaded with a FTP script
> And after uploading the file must be deleting in de local folder (NOT!
> on the ftp server).
>
> After deleting, the batch is finish.
>
> So who can make some script? :-)
>
>
>
> Steven


You probably need to think a little harder about your requirements. In your
example you write

==========
(Example: When i run the batch file on 2008-12-16 and on time 16:02:57,
the name of the file that must be renamed is:
movie_1_20081206_160257.wmv and must be renamed in movie.wmv)
==========

In other words, you expect the batch file to do this:
ren movie_1_20081206_160257.wmv movie.mwv

This requirement will cause many failures because it is quite likely that
the "seconds" have ticked over to the next number by the time the batch file
runs. Putting it another way, your file name might be
movie_1_20081206_160257.wmv
but it might well be 16:02:58 at the time the batch file runs. It might even
be much later if the system is very busy, e.g. with a virus scanner pattern
file update or with an Automatic Windows Update.


 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      12-16-2008
You could use something like this:

@echo off
set Source=d:\Movie Files
set script=c:\script.scr
set site=ftp.jansen.com
set user=steven
set password=SomePassword

for /F "delims=" %%a in ('dir /b /od "%Source%"') do set name=%%a
if exist "%Source%\movie.mwv" del "%Source%\movie.mwv"
ren "%Source%\%name%" movie.mwv

echo> %script% %user%
echo>>%script% %password%
echo>>%script% binary
echo>>%script% put "%name%"
echo>>%script% quit

ftp -s:%Script% %site%
del %script%
del "%Source%\movie.mwv"


"stevenjansen" <> wrote in message
news:...
>
> OK, i'm sorry, My English is very bat. But I think what you mean.
> Maybe is this possible idea:
>
> A program on my computer will open the batchfile
> The batchfile wil sleep "X" seconds
> After sleep "X" seconds, the batchfile will rename a file that is on
> the last time modified.
>
> With other words; A file that is last modified will rename by the batch
> file in "movie.exe".
> Than the file will be uploaded bij a ftp and after that de local file
> will be deleted.
>
>
> --
> stevenjansen
> ------------------------------------------------------------------------
> stevenjansen's Profile:
> http://forums.techarena.in/members/stevenjansen.htm
> View this thread: http://forums.techarena.in/server-scripting/1088584.htm
>
> http://forums.techarena.in
>



 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      12-17-2008

"stevenjansen" <> wrote in message
news:...
>
> Ok super, thank you!
> I've copy the complete script in Notepad and save the file in de folder
> "C:\test\script.bat".
>
> I see: "set script=c:\script.scr"
> Could you tell what the file "script.scr" is?
> --
> stevenjansen
> ------------------------------------------------------------------------
> stevenjansen's Profile:
> http://forums.techarena.in/members/stevenjansen.htm
> View this thread: http://forums.techarena.in/server-scripting/1088584.htm
>
> http://forums.techarena.in


Script.scr is a script file containing a number of commands that are
meaningful for ftp.exe. It gets generated each time you run the batch file.
If you prefer then you can call it stevenjansen.xyz . . .


 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      12-17-2008
Thanks for the feedback.

"stevenjansen" <> wrote in message
news:...
>
> Thank you! It's works perfectly.
>
>
> --
> stevenjansen



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cmd batchfile - keep window open? Julian Windows Vista General Discussion 4 01-19-2008 04:04 AM
Re: How to check a special file which have a special file which have Pegasus \(MVP\) Windows Server 1 07-06-2007 06:59 AM
Special Permissions Allenb Windows Vista General Discussion 1 06-11-2006 10:42 PM
Special SW Ghada Active Directory 1 02-18-2004 10:51 PM
Re: Special offer Jonathan Kay [MVP] Windows MSN Messenger 7 07-23-2003 10:14 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59