Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.