NEED CODE TO SPECIFY ONLY THE FILE I NEED TO COPY IN A FOLDER - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

NEED CODE TO SPECIFY ONLY THE FILE I NEED TO COPY IN A FOLDER

LelouchLelouch Posts: 2Member
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..

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    [color=Blue]Link to HELP PC online:
    [link=http://docs.huihoo.com/help-pc/int-int_21.html]http://docs.huihoo.com/help-pc/int-int_21.html[/link]

    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.
    [/color]
  • LelouchLelouch Posts: 2Member
    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..
  • PatrickMc2008PatrickMc2008 Posts: 11Member
    To copy files created in Dec 2009, you can use this script.



    [code]# 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[/code]


    To copy files by name, change the lf command to

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


    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.


    [code]script "C:/Scripts/CopyByDate.txt"[/code]


Sign In or Register to comment.