Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
Old 06-21-08, 10:14 PM   #1
Infinity666
Yeah I like vw's so what?
 
Infinity666's Avatar
 
Join Date: Oct 2005
Location: Spokane wa (Spocompton)
Posts: 679
Send a message via AIM to Infinity666 Send a message via MSN to Infinity666
Default Need to make a super simple program

All I need the ability to copy a few files from one directory to another but it needs to do this every 2 seconds or so.... im a complete programing novice but i have access to visual basic.

Thanks
__________________
Quote:
The internet is not a truck! The internet is a series of tubes! - Sen. Ted Stevens (R-AK)
|X2 5200+ |GigabyteGA-M61P-S3 | 1GB ddr2 533|Evga 7600gt|Sony dru-710a dvd+/- rw | Aspire 500w psu |Seagate 80gb|Seagate 250gb|

.....\____
..../__|__\___
....\(o)___(o)/
Infinity666 is offline   Reply With Quote
Old 06-22-08, 05:48 PM   #2
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Re: Need to make a super simple program

You need to be a little more specific

Where is the source of the file?
Where is the destination of the file?
What kind of file is it?
Are you looking to "read" the file and write its contents to a different file or do you want to copy the object itself(which brings more questions)?

edit: oh yeah, visual studio supports quite a few options for languages... you looking for something in java, c#, .NET...???
__________________

Gaming

MSI MPower Z87 | 4770k | CNPS9900MAX-B | 8GB G.Skill 1866 | EVGA GTX760 |ThermalTake 850w | X-Fi Titanium | HAF | Asus PA248Q | Lycosa | Death Adder | Win8 Pro 64

Dev/Backup

MSI GD65 | 2500k | H50 | 8GB G.skill | GTX570 | Ubuntu 13.10

Laptop

17" Inspiron | i5 | 4GB DDR3 | 500GB HDD | Win7 Pro 64

jcrox is offline   Reply With Quote
Old 06-23-08, 07:41 AM   #3
wnd
Nerd, Geek, Freak
 
wnd's Avatar
 
Join Date: Sep 2005
Location: Finland
Posts: 703
Default Re: Need to make a super simple program

Code:
#! /bin/sh

while true; do
        cp -dpR source destination
        sleep 2
done
Especially if you only need to do this temporarily, a simple script should suffice just fine. Note that if you're processing large number of files, two second interval could prove to be a bit too short.

If you want to make copying smarter (only copy the files when they're changed), use rsync.

Code:
#! /bin/sh

while true; do
        rsync -u source destination
        sleep 2
done
If you want copying to /start/ every N seconds, you could replace the main loop with something like the following. It will /not/ handle fractions of seconds well so it's not very accurate.

Code:
n=10 # start copy every N seconds
before=$(date +%s)
while true; do
        # copying happens here
        after=$(date +%s)
        sleep $(( n - after + before ))
        before=after # save one call to date
done
If you're running Windows you can install Cygwin, or rewrite the script as batch-program.
__________________
web | cat

Christianity, noun: The belief that a cosmic Jewish Zombie who was his own father can make you live forever if you symbolically eat his flesh and telepathically tell him you accept him as your master, so he can remove an evil force from your soul that is present in humanity because a rib-woman was convinced by a talking snake to eat from a magical tree. [mad.frog]
wnd is offline   Reply With Quote
Old 06-26-08, 04:09 PM   #4
ViN86
 
Join Date: Mar 2004
Posts: 15,486
Default Re: Need to make a super simple program

i would do it with C# and i would make a GUI that allows you to specify the source directory and the target directory for the copy. also, do you want to rename the files each time?
ViN86 is offline   Reply With Quote
Old 06-26-08, 05:05 PM   #5
dxx
Registered User
 
Join Date: Nov 2007
Posts: 490
Default Re: Need to make a super simple program

For maximum ease, I'd just cheat. Make a super-super-simple VB app that has only two functions, a timer, and a bit of code to execute an external batch file. Here's how to do it:

1) Create a new VB project
2) Drag the timer icon onto the main program window
3) Double-click the timer
4) Paste the code below under the timer function -

Private Sub Form_Load()
Shell ("c:\copything.bat")
End Sub


(I think that should work, it's been about a year since I last wrote a VB app that called upon other exe's)
5) Add a button to the page, name it "Start"
6) Double-click it, enter

timer1.enabled=true

7) Compile, it should work.
dxx is offline   Reply With Quote
Reply


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
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Now Available - LEGO® Batman 2 DC Super Heroes� News Archived News Items 0 06-23-12 12:00 AM
"GPU has fallen off the bus" error on 650M unless a CUDA program run first amonakov NVIDIA Linux 0 06-18-12 06:34 PM
OSC's Oakley Super is Tops in Efficiency News Archived News Items 0 06-03-12 04:10 PM
Yellowstone Super First to Crunch Local Climate Models News Archived News Items 0 05-30-12 02:40 PM

All times are GMT -5. The time now is 04:10 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright ©1998 - 2014, nV News.