Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 3rd, 2006, 11:44 PM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 6 m 2 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Functions and Batch files? Incremental copying?

Ok. I'm an access person and the "computer guy" at work asked me about batch files. I don't know anything about batch files except what I've read online the last couple of days.

Here's what we're looking for. We just got new registers at work and the background system is running on windows. There's a buch of mdb filoes but no access, so it's running SQL (confirmed from helpdesk). Every day, at close of the business day, the system creates snapshot file(s) with the closing reports. Unfortunately, come the next day, those files are overwritten with new ones, so unless someone goes in there and physically copies them to another folder on the network, they're lost.

He'd like to know if there's a batch file code that will either automatically create a new folder (or file) in the destination directory that increments by one or name it by current date (preferred), or send a prompt where the user can type in the date. Does that makes sense? As I'm typing this, I'm wondering if there's a simple VB code for this. I haven't coded VB since school

Any help is appreciated.

Thanks.
Jim
__________________
Just hoping I can give as much as I get from here

Reply With Quote
  #2  
Old April 3rd, 2006, 11:54 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
ASP Free Specialist (4000 - 4499 posts)
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,381 lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)lewy User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 1 Day 23 h 7 m 43 sec
Reputation Power: 1488
Sorry Jim, wrong forum
The code Bank is only for code samples not for programming help.

Anyhow, this batch file, does it have to fire on a time basis? Batch files are the long forgotten children of windows and are seldomly used (though they're quite powerful, if coded correctly)

All this can be done in a batch file without VB of any kind.
Plus it can be scheduled using the task scheduler to run at a set time.
__________________
................... ASCII and ye shall receive ..................
Knowledge is the only resource on earth that multiplies when shared


Support the Shemzilla Project
Powered by C#

Reply With Quote
  #3  
Old April 4th, 2006, 12:29 AM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 6 m 2 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Thanks and sorry. It's not a time thing. He, or someone in management, would just click the file icon after the close of the books, and be done with it...hopefully.

Again, any help is appreciated.

Last edited by OneRedLT4 : April 4th, 2006 at 01:37 PM.

Reply With Quote
  #4  
Old April 6th, 2006, 01:28 AM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 6 m 2 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Hmmm, maybe I should try a different forum?

Reply With Quote
  #5  
Old April 6th, 2006, 04:50 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,635 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 55 m 37 sec
Reputation Power: 1902
--moved to the Programming Help forum.

Jim, the best and most simple thing to do is creating small application that will
do the job.. I can do something in C# for you if you want let me know and I'll
do that when i'll have some time. should take me no more than 10 minutes.

Reply With Quote
  #6  
Old April 7th, 2006, 03:27 PM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 6 m 2 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Quote:
Originally Posted by Shadow Wizard
--moved to the Programming Help forum.

Jim, the best and most simple thing to do is creating small application that will
do the job.. I can do something in C# for you if you want let me know and I'll
do that when i'll have some time. should take me no more than 10 minutes.

Thanks for moving the thread, I was just logging in to repost here.

I don't know if he knows any C# so I'd hate for you to waste your time. I don't know how similar C# is to the batch lingo.
However, I'd never turn down an opportunity to accept help, especially when i can learn from it.

Thanks.

Reply With Quote
  #7  
Old April 7th, 2006, 03:29 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,635 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 55 m 37 sec
Reputation Power: 1902
ok then, I'll create something simple that will accept command line arguments and be
as flexible as possible. remind me within couple of days..

Reply With Quote
  #8  
Old April 9th, 2006, 01:42 AM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 6 m 2 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Quote:
Originally Posted by Shadow Wizard
ok then, I'll create something simple that will accept command line arguments and be
as flexible as possible. remind me within couple of days..


Will do, thanks

Meanwhile, just incase, anyone know how to do in Batch?
Hmm, wonder if can do in Access....

Reply With Quote
  #9  
Old April 9th, 2006, 09:22 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,635 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 55 m 37 sec
Reputation Power: 1902
attached is command line application that get file path as
its first argument and folder path as the second argument,
and will copy the given file to the given folder while giving
the file name in the format:
[original name]_DDMMYYYY.[original extension]
in the destination folder.
for example this command:
SmartBackup.exe C:\test.txt C:\MyFolder will copy the file
test.txt from C:\ into C:\MyFolder\test_09042006.txt

attached is also sample batch file that will automatically
copy one file in single click.

let me know if there are any further questions, attached
is also the C# source code.
Comments on this post
OneRedLT4 agrees: Friggin' awesome stuff!!!
Attached Files
File Type: zip SmartBackup.zip (2.9 KB, 383 views)

Reply With Quote
  #10  
Old April 12th, 2006, 02:08 AM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 6 m 2 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Quote:
Originally Posted by Shadow Wizard
attached is command line application that get file path as
its first argument and folder path as the second argument,
and will copy the given file to the given folder while giving
the file name in the format:
[original name]_DDMMYYYY.[original extension]
in the destination folder.
for example this command:
SmartBackup.exe C:\test.txt C:\MyFolder will copy the file
test.txt from C:\ into C:\MyFolder\test_09042006.txt

attached is also sample batch file that will automatically
copy one file in single click.

let me know if there are any further questions, attached
is also the C# source code.

Cool! I'll have to look at it and try to learn something. What is the exe file? Is that really complicated to learn how to create it to use the attached file for info?

You know, one thing I have notice about this forum, is that so many of you are so damn smart when it comes to this stuff!! While you were whipping out this really cool piece of coding, I lucked out and found the pieces needed to construct it in a batch file. I've included it below incase anyone's interested. I've now slightly modded it to backup both ways folders and files between my laptop and my desktop.

Code:
 @echo off
    :: variables
    set drive=K:\Backup
    set folder=%date:~10,4%_%date:~4,2%_%date:~7,2%
    set backupcmd=xcopy /s /c /d /e /h /i /r /k /y

echo ### Backing Daily closing Reports...
   %backupcmd% "C:\closing reports\daily" "%drive%\%folder%"

echo Backup Complete!
    @pause

Last edited by OneRedLT4 : April 12th, 2006 at 03:04 AM.

Reply With Quote
  #11  
Old April 12th, 2006, 08:44 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,635 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 55 m 37 sec
Reputation Power: 1902
that's really cool code, looks like that's what you were after.
in the attached zip there is exe file you can use, but if you got it working
via pure batch code it's better.

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > Functions and Batch files? Incremental copying?


Thread Tools  Search this Thread 
Search this Thread: