Bitcoin Forum
November 17, 2024, 09:58:43 AM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: [CLOSED] Simple script required - payment in btc  (Read 1879 times)
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 04:40:35 AM
Last edit: February 14, 2012, 07:36:46 AM by bitcoinTrader
 #1

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!


mb300sd
Legendary
*
Offline Offline

Activity: 1260
Merit: 1000

Drunk Posts


View Profile WWW
February 13, 2012, 04:58:31 AM
Last edit: February 13, 2012, 08:12:42 AM by mb300sd
 #2

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\
   }
}

1D7FJWRzeKa4SLmTznd3JpeNU13L1ErEco
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 05:20:17 AM
 #3

Sorry, require simple batch script, not powershell.

I want to run the script on Windows Server 2003.

bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 07:08:26 AM
 #4

Bump

Any1?

btc_artist
Full Member
***
Offline Offline

Activity: 154
Merit: 102

Bitcoin!


View Profile WWW
February 13, 2012, 07:26:41 AM
 #5

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

BTC: 1CDCLDBHbAzHyYUkk1wYHPYmrtDZNhk8zf
LTC: LMS7SqZJnqzxo76iDSEua33WCyYZdjaQoE
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 08:42:47 AM
 #6

Already tried that, doesnt work.

BinoX
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
February 13, 2012, 01:38:37 PM
 #7

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)
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 02:17:13 PM
 #8

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?

BinoX
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
February 13, 2012, 02:21:03 PM
 #9

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
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 02:27:54 PM
 #10

I assume if exe can be made, batch can also be made with same commands, right?

BinoX
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
February 13, 2012, 02:30:42 PM
 #11

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
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 02:32:37 PM
 #12

Can you do it in batch?
How much will you charge for that?

BinoX
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
February 13, 2012, 02:36:00 PM
 #13

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
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 02:46:54 PM
 #14

BTW, in which language can you make exe?
Also, source will be available?

eroxors
Legendary
*
Offline Offline

Activity: 924
Merit: 1000


Think. Positive. Thoughts.


View Profile WWW
February 13, 2012, 04:38:48 PM
 #15

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
 )

BinoX
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
February 13, 2012, 05:22:54 PM
 #16

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 Smiley
bitcoinTrader (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
February 13, 2012, 05:32:00 PM
 #17

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.

Bitsky
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
February 13, 2012, 05:56:47 PM
 #18

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

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
gutschilla
Newbie
*
Offline Offline

Activity: 17
Merit: 0



View Profile
February 13, 2012, 07:57:25 PM
 #19

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)?
mb300sd
Legendary
*
Offline Offline

Activity: 1260
Merit: 1000

Drunk Posts


View Profile WWW
February 14, 2012, 02:43:43 AM
 #20

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"

1D7FJWRzeKa4SLmTznd3JpeNU13L1ErEco
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!