Bitcoin Forum

Economy => Services => Topic started by: bitcoinTrader on February 13, 2012, 04:40:35 AM



Title: [CLOSED] Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 04:40:35 AM
Hi,

I require simple windows batch script to do the following:

If the file is older than 2 minutes in a particular folder, copy the file to another location.

Should be easy job.

Please post here or PM.

Thanks!



Title: Re: Simple script required - payment in btc
Post by: mb300sd on February 13, 2012, 04:58:31 AM
Not particulrly good with batch files, but if your running on Vista or 7, this powershell script should do it.

$files=get-childitem .
$date = get-date
$date = $date.AddMinutes(-2)
foreach ($file in $files) {
   if ($date -lt $file.LastWriteTime) {
      copy $file dir\
   }
}


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 05:20:17 AM
Sorry, require simple batch script, not powershell.

I want to run the script on Windows Server 2003.


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 07:08:26 AM
Bump

Any1?


Title: Re: Simple script required - payment in btc
Post by: btc_artist on February 13, 2012, 07:26:41 AM
Google is your friend. This should work with minor modifications:

http://stackoverflow.com/questions/3185489/dos-batch-file-for-copy-files-older-than-30-minute-from-one-forder-to-other-fold


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 08:42:47 AM
Already tried that, doesnt work.


Title: Re: Simple script required - payment in btc
Post by: BinoX on February 13, 2012, 01:38:37 PM
Any particular reason you want it to be a batch script rather than a simple exe file?
(If you would be happy with an exe I can make you one in about 2 or 3 mins)


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 02:17:13 PM
I want to run from Control M software.
I have never executed exe, only bat and sh files

Is there much difference between exe and bat files?


Title: Re: Simple script required - payment in btc
Post by: BinoX on February 13, 2012, 02:21:03 PM
If you can run bat files you should be able to run exe files.

If you can't do it directly then you could always put the exe file on the machine and then run it from a bat


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 02:27:54 PM
I assume if exe can be made, batch can also be made with same commands, right?


Title: Re: Simple script required - payment in btc
Post by: BinoX on February 13, 2012, 02:30:42 PM
An exe file is different. It's a complied program rather than a script.

There probably IS a way to do it with a .bat file, but I don't think it will be as simple as it seems


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 02:32:37 PM
Can you do it in batch?
How much will you charge for that?


Title: Re: Simple script required - payment in btc
Post by: BinoX on February 13, 2012, 02:36:00 PM
Can you do it in batch?
How much will you charge for that?

To be honest, I'm not 100% sure that I would be able to do it as a batch file, it's been a long time since I've done any proper batch file creation (since I usually just write programs to do things these days)

If I find a solution, I will let you know


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 02:46:54 PM
BTW, in which language can you make exe?
Also, source will be available?


Title: Re: Simple script required - payment in btc
Post by: eroxors on February 13, 2012, 04:38:48 PM
Not sure if this will work for you, but it copies all files every 2 minutes (120 seconds) 720 times (1 day), regardless of age. You can then set the batch to run with windows task manager once a day.

@echo off
 for /L %%a in (1,1,720) do (
 xcopy /d /y /c c:\folder1\*.* c:\folder2\
 ping localhost -n 120 > nul
 )


Title: Re: Simple script required - payment in btc
Post by: BinoX on February 13, 2012, 05:22:54 PM
BTW, in which language can you make exe?
Also, source will be available?

For little utilities like this I use a language called purebasic (see www.purebasic.com for details) It's a great language to use for any small tools that you want written quickly.

And yes, source code would be available :)


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 13, 2012, 05:32:00 PM
Not sure if this will work for you, but it copies all files every 2 minutes (120 seconds) 720 times (1 day), regardless of age. You can then set the batch to run with windows task manager once a day.

@echo off
 for /L %%a in (1,1,720) do (
 xcopy /d /y /c c:\folder1\*.* c:\folder2\
 ping localhost -n 120 > nul
 )

This is kind of scheduler, but I already have scheduled job running via control m.
I want 2 min old files to be copied.


Title: Re: Simple script required - payment in btc
Post by: Bitsky on February 13, 2012, 05:56:47 PM
Write the program in any language you want and compile it if needed.
Then just call it from within a batch script by using "START".
Or maybe I don't see your problem here...


Title: I can do it if you like
Post by: gutschilla on February 13, 2012, 07:57:25 PM
My solution would be a small c++ program that outputs every file in a given directoy that's older than 2 minutes. You would have to place this program somewhere in your $PATH. Then you would be able to create a batch file that simply copies each file somewhere. Do you have access to your machine in a way to install programs (I mean, just putting an .exe in your windows folder)?


Title: Re: Simple script required - payment in btc
Post by: mb300sd on February 14, 2012, 02:43:43 AM
If you can install software, you cal always use the above script i posted, just install powershell (http://support.microsoft.com/kb/968929 ) and make a batch file with "powershell -File aboveScript.ps1"


Title: Re: Simple script required - payment in btc
Post by: bitcoinTrader on February 14, 2012, 07:35:56 AM
I have found BATCH ONLY solution for this problem.
Thanks every1 for the input.

Edit: As requested, I am posting the link
http://stackoverflow.com/questions/7618210/search-by-seconds-not-minutes (http://stackoverflow.com/questions/7618210/search-by-seconds-not-minutes)