MS-DOS

Moderators: blip
Number of threads: 389
Number of posts: 904

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
NEED CODE TO SPECIFY ONLY THE FILE I NEED TO COPY IN A FOLDER Posted by Lelouch on 28 Dec 2009 at 7:29 PM
guys help me plss..

i need to copy files from a folder but not all the files in it must be copied..i need to pick only the files i need, but how?

for ex.
20091211
20091108
20091213
20091009
20091226

i only need to copy files from december only..so i must copy onlt this files:
20091211
20091213
20091226

plsss help me..
thanks in advance..
Report
Re: NEED CODE TO SPECIFY ONLY THE FILE I NEED TO COPY IN A FOLDER Posted by AsmGuru62 on 29 Dec 2009 at 5:17 AM
Link to HELP PC online:
http://docs.huihoo.com/help-pc/int-int_21.html

You need to enumerate all files in your folder with these services:
AH=4Eh (Find First File)
AH=4Fh (Find Next File)

During these calls DOS will fill the information about each file into DTA object (which can be set by AH=1Ah service). That object has DATE & TIME of the file. Use it to select only the files needed for copying.
Report
Re: NEED CODE TO SPECIFY ONLY THE FILE I NEED TO COPY IN A FOLDER Posted by Lelouch on 3 Jan 2010 at 4:43 PM
thanks for the info..

sorry if i didn't specify it earlier but what i need is a code to create a batch file..

thanks again..
Report
Re: NEED CODE TO SPECIFY ONLY THE FILE I NEED TO COPY IN A FOLDER Posted by PatrickMc2008 on 13 Jan 2010 at 10:00 AM
To copy files created in Dec 2009, you can use this script.



# Script CopyByDate.txt
var str list, file
cd "C:/Folder1"
lf -n "*" "." (($fctime >= "20091201") AND ($fctime <= "20091231")) > $list
while ($list <> "")
do
    lex "1" $list > $file
    system copy ("\""+$file+"\"") ("\""+"C:/Folder2"+"\"")
done



To copy files by name, change the lf command to

lf -n "*" "." (($fname >= "20091201") AND ($fname <= "20091231")) > $list



Both scripts are in biterscripting ( http://www.biterscripting.com ). To try, save the script in file C:/Scripts/CopyByDate.txt, execute it with the following command.


script "C:/Scripts/CopyByDate.txt"






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.