Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Platform/API C++

Reply
 
LinkBack Thread Tools Display Modes
Old 04-17-2009, 06:54 PM   #1 (permalink)
satya85
Recruit
 
Join Date: Apr 2009
Posts: 5
satya85 is on a distinguished road
Batch Script to check for timestamp and copy to other directory

Experts,
I need a batch scripts that looks for timestamp for a set of files and after validating copies all files having latest timestamp to another directory. Please help

Thanks in advance
satya85 is offline   Reply With Quote
Old 04-19-2009, 03:12 AM   #2 (permalink)
satya85
Recruit
 
Join Date: Apr 2009
Posts: 5
satya85 is on a distinguished road
For ex, say 10 files in folder A, then check timestamp of each, and if its the latest file ( with 24 hours ) then copy to folder B.
satya85 is offline   Reply With Quote
Old 04-19-2009, 11:37 AM   #3 (permalink)
SenHu
Recruit
 
Join Date: Apr 2009
Posts: 2
SenHu is on a distinguished road
Script to copy latest files from one folder to another

You did not mention which timestamp - last modification time, last acces time or last creation time. I will assume last modification time.

Here is the script. It is written in biterscripting. It will copy files modified after a certain time stamp from folder A to B.

Code:
# Get a list of all files whose time stamp is after 20090418.
var str filelist ; find -n "*" "folder A" ($fmtime > "20090418") > $filelist
while ($filelist <> "")
do
    # Get the next file.
    var str file ; lex "1" $filelist > $file
    # Copy file to folder B.
    system copy $file "folder B"
done
The above script will copy all files modified after Apr 18, 2009.

Copy the above script into file C:/X.txt. Start biterscripting and call the script as follows.

Code:
script "C:/X.txt"
That's it. (Use correct values for folder A, folder B and 20090418, which is Apr 18, 2009.)

You can download biterscripting free. Just follow installation instructions at http://www.biterscripting.com/install.html .

Sen
SenHu is offline   Reply With Quote
Old 04-19-2009, 12:32 PM   #4 (permalink)
satya85
Recruit
 
Join Date: Apr 2009
Posts: 5
satya85 is on a distinguished road
Hi SenHu,
Thanks for the reply. i am trying to get a script that should be scheduled. So the set of files should be checked for timestamp, copied to other folder and validate if its copied.
satya85 is offline   Reply With Quote
Old 04-19-2009, 02:11 PM   #5 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 841
DJMaze is on a distinguished road
for which operating system???
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 04-19-2009, 06:28 PM   #6 (permalink)
satya85
Recruit
 
Join Date: Apr 2009
Posts: 5
satya85 is on a distinguished road
windows xp
satya85 is offline   Reply With Quote
Old 04-21-2009, 12:46 PM   #7 (permalink)
SenHu
Recruit
 
Join Date: Apr 2009
Posts: 2
SenHu is on a distinguished road
Scheduling biterscripting script to run automatically

Hi satya85:

You can schedule the above script to be run at any time as follows. Instead of calling the script from biterscripting interactively, schedule the following command line with windows scheduler.

"C:/biterscripting/biterscripting.exe" "C:/X.txt"

Sen
SenHu is offline   Reply With Quote
Old 05-24-2009, 12:40 PM   #8 (permalink)
satya85
Recruit
 
Join Date: Apr 2009
Posts: 5
satya85 is on a distinguished road
Hi All,

Please provide a utility which can be used to get the timestamp of files, that can used in batch scripts, cannot use biterscripting here.
satya85 is offline   Reply With Quote
Reply

Bookmarks

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timestamp -- sequential? metazai PHP 3 06-26-2007 10:33 AM
Need help with a simple batch script Redline Windows 4 07-06-2006 05:34 PM
copy a directory link with -Rs sde Linux / BSD / OS X 3 02-15-2005 05:34 PM
sde, changing directory script is running in? Admin PHP 2 06-23-2003 12:02 PM


All times are GMT -8. The time now is 04:50 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting