Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Poll

Creat a batch file that can copy data from a specific drive

email
2 (66.7%)
post
1 (33.3%)

Total Members Voted: 3

Author Topic: Creating batch file  (Read 12508 times)

0 Members and 1 Guest are viewing this topic.

navin

    Topic Starter


    Greenhorn

    Creating batch file
    « on: September 09, 2008, 06:28:05 AM »
    Hello

    Hope you can help, I want create a batch file that can copy all jpeg, gif and mp3 files from a network drive I: on various machines and return the information on a text file.
    Please post me what commands to use. Thanks

    fireballs



      Apprentice

    • Code:Terminal
    • Thanked: 3
      Re: Creating batch file
      « Reply #1 on: September 09, 2008, 06:34:34 AM »
      you cuold lookup
      Code: [Select]
      ftp /?
      or use xcopy if all the computers are networked.

      FB
      Next time google it.

      Dias de verano

      • Guest
      Re: Creating batch file
      « Reply #2 on: September 09, 2008, 07:50:43 AM »
      why the poll?

      navin

        Topic Starter


        Greenhorn

        Re: Creating batch file
        « Reply #3 on: September 09, 2008, 09:42:25 AM »
        Thanks, but let me be clear what exactly I want to do is I need to run query on user's home drive which should return me with information on all the jpeg, gif and mp3 files stored on their drives.

        how would I go about creating a batch file that can to this task for me. All your help will be much appriciated. Thanks

        fireballs



          Apprentice

        • Code:Terminal
        • Thanked: 3
          Re: Creating batch file
          « Reply #4 on: September 09, 2008, 10:02:55 AM »
          that's better...

          Code: [Select]
          where /t /r c:\ *.mp3 *.gif *.jpeg
          FB
          Next time google it.

          Dias de verano

          • Guest
          Re: Creating batch file
          « Reply #5 on: September 09, 2008, 10:10:47 AM »
          that's better...

          Code: [Select]
          where /t /r c:\ *.mp3 *.gif *.jpeg
          FB

          fireballs, the where command is not part of a standard Windows installation.

          fireballs



            Apprentice

          • Code:Terminal
          • Thanked: 3
            Re: Creating batch file
            « Reply #6 on: September 09, 2008, 11:53:50 AM »
            it's part of the standard 'vista home premium'... but i appologise if it doesn't work. try
            Code: [Select]
            dir /s c:\ | find .mp3
            dir /s c:\ | find .gif
            dir /s c:\ | find .jpg

            FB
            Next time google it.

            Dias de verano

            • Guest
            Re: Creating batch file
            « Reply #7 on: September 09, 2008, 12:34:28 PM »
            it's part of the standard 'vista home premium'... but i appologise if it doesn't work.

            OK. I'm still using XP.

            fireballs



              Apprentice

            • Code:Terminal
            • Thanked: 3
              Re: Creating batch file
              « Reply #8 on: September 09, 2008, 12:39:20 PM »
              i didn't know it was only on vista, thanks

              FB
              Next time google it.

              dramklukkel



                Rookie

                Re: Creating batch file
                « Reply #9 on: September 10, 2008, 03:55:55 AM »
                Hi FB

                I think it needs an asterix. In XP it returns an error when that's not present. Unvalid parameter. Did not manage to output any results to a txtfile, because that produces the same error.
                Code: [Select]
                dir /s c:\ | find *.mp3
                dir /s c:\ | find *.gif
                dir /s c:\ | find *.jpg

                This works for me though.
                Code: [Select]
                dir *.mp3 /s/w/b/o >> list.txt

                grt,
                Dramklukkel.

                fireballs



                  Apprentice

                • Code:Terminal
                • Thanked: 3
                  Re: Creating batch file
                  « Reply #10 on: September 10, 2008, 05:24:21 AM »
                  Hi FB

                  I think it needs an asterix. In XP it returns an error when that's not present. Unvalid parameter. Did not manage to output any results to a txtfile, because that produces the same error.
                  Code: [Select]
                  dir /s c:\ | find *.mp3
                  dir /s c:\ | find *.gif
                  dir /s c:\ | find *.jpg

                  This works for me though.
                  Code: [Select]
                  dir *.mp3 /s/w/b/o >> list.txt

                  grt,
                  Dramklukkel.

                  hmmm it seems this is another incompatability between vista and XP. i have to admit that i missed off quotation marks around the ".mp3" but if i use "*.mp3" it doesn't find anything  ???  >:(

                  also dir *.mp3 /s/w/b/o doesn't work for me.

                  FB
                  Next time google it.

                  navin

                    Topic Starter


                    Greenhorn

                    Re: Creating batch file
                    « Reply #11 on: September 10, 2008, 10:07:22 AM »
                    Guys Thanks very much for your help but I have tried all to no avail.

                    I am on windows 2000 and want the query to be returned on a text file

                    Dias de verano

                    • Guest
                    Re: Creating batch file
                    « Reply #12 on: September 10, 2008, 10:08:04 AM »
                    find needs quotes but you don't need find, because it may not do what you want.

                    dir | find ".mp3" will find any line in the output of dir which contains the 4 character string .mp3 so it would find this file which is not an mp3 file - horsecowcatdog.mp3.doc

                    You do need an asterisk for filespec wildcards as used by dir.

                    dir *.mp3 will find only files with the extension .mp3

                    fireballs



                      Apprentice

                    • Code:Terminal
                    • Thanked: 3
                      Re: Creating batch file
                      « Reply #13 on: September 10, 2008, 10:16:03 AM »
                      to get the output in a text file use:
                      Code: [Select]
                      dir *.mp3>list.txt
                      dir *.jpg>>list.txt
                      dir *.gif>>list.txt

                      FB
                      Next time google it.

                      Dias de verano

                      • Guest
                      Re: Creating batch file
                      « Reply #14 on: September 10, 2008, 11:03:57 AM »
                      Thanks, but let me be clear what exactly I want to do is I need to run query on user's home drive which should return me with information on all the jpeg, gif and mp3 files stored on their drives.

                      how would I go about creating a batch file that can to this task for me. All your help will be much appriciated. Thanks

                      Is this your school homework?

                      fireballs



                        Apprentice

                      • Code:Terminal
                      • Thanked: 3
                        Re: Creating batch file
                        « Reply #15 on: September 10, 2008, 04:51:18 PM »

                        Is this your school homework?


                        using DOS? i don't think DOS has ever been taught in schools.

                        FB
                        Next time google it.

                        Dias de verano

                        • Guest
                        Re: Creating batch file
                        « Reply #16 on: September 11, 2008, 11:34:03 AM »
                        i don't think DOS has ever been taught in schools.

                        On what do you base that statement?

                        A reply please.




                        Jacob



                          Hopeful

                          Thanked: 1
                          • Experience: Expert
                          • OS: Windows XP
                          Re: Creating batch file
                          « Reply #17 on: September 11, 2008, 11:46:54 AM »
                          i don't think DOS has ever been taught in schools.

                          On what do you base that statement?

                          A reply please.





                          I haven't been taught it.
                          May be different in America.

                          Dias de verano

                          • Guest
                          Re: Creating batch file
                          « Reply #18 on: September 11, 2008, 11:53:36 AM »
                          Schools in many countries all around the world use MS-DOS, Qbasic, batch language, Windows command prompt in their computer and IT courses. To say that "DOS" has never been taught in schools is a remarkably sweeping (and rather ignorant) statement.

                          Jacob



                            Hopeful

                            Thanked: 1
                            • Experience: Expert
                            • OS: Windows XP
                            Re: Creating batch file
                            « Reply #19 on: September 11, 2008, 11:54:53 AM »
                            Schools in many countries all around the world use MS-DOS, Qbasic, batch language, Windows command prompt in their computer and IT courses. To say that "DOS" has never been taught in schools is a remarkably sweeping (and rather ignorant) statement.


                            True, I was just adding that it is not in the English curriculum.

                            Dias de verano

                            • Guest
                            Re: Creating batch file
                            « Reply #20 on: September 11, 2008, 12:00:57 PM »
                            Quote from: Jacob
                            True, I was just adding that it is not in the English curriculum.

                            Well, they teach it in at least one secondary school in Bristol that I know about.
                            « Last Edit: September 11, 2008, 12:26:58 PM by Dias de verano »

                            Jacob



                              Hopeful

                              Thanked: 1
                              • Experience: Expert
                              • OS: Windows XP
                              Re: Creating batch file
                              « Reply #21 on: September 11, 2008, 12:06:41 PM »
                              Quote from: Jacob
                              True, I was just adding that it is not in the English curriculum.

                              Well, they teach it at least one secondary school in Bristol that I know about.

                              Well obviously I am wrong.
                              I forgot schools can change their curriculum, and obviously if an IT technician or teacher feels teaching DOS would be beneficial then they can teach it, with the backing of the headteacher and or governing body.

                              Dias de verano

                              • Guest
                              Re: Creating batch file
                              « Reply #22 on: September 11, 2008, 12:28:03 PM »
                              You clearly haven't noticed the large number of DOS homework questions that are posted in this part of the forum.

                              Jacob



                                Hopeful

                                Thanked: 1
                                • Experience: Expert
                                • OS: Windows XP
                                Re: Creating batch file
                                « Reply #23 on: September 11, 2008, 01:00:30 PM »
                                Wrong, I have.
                                But I don't see why you are getting shirty with me, I didn't make the assumption in the first place.

                                Dias de verano

                                • Guest
                                Re: Creating batch file
                                « Reply #24 on: September 11, 2008, 02:11:42 PM »
                                Wrong, I have.
                                But I don't see why you are getting shirty with me, I didn't make the assumption in the first place.

                                I'm sorry, I didn't mean to sound shirty. Sorry if it came over that way. I posted in haste. Also you're right, it was our friend who hasn't answered who made the assumption.

                                fireballs



                                  Apprentice

                                • Code:Terminal
                                • Thanked: 3
                                  Re: Creating batch file
                                  « Reply #25 on: September 12, 2008, 05:30:35 AM »
                                  yup i was wrong, sorry. I guess we both posted in haste.


                                  FB
                                  Next time google it.

                                  Dias de verano

                                  • Guest
                                  Re: Creating batch file
                                  « Reply #26 on: September 12, 2008, 10:07:52 AM »
                                  Still, there's always a silver lining - our post counts have gone up  :)

                                  navin

                                    Topic Starter


                                    Greenhorn

                                    Re: Creating batch file
                                    « Reply #27 on: September 16, 2008, 05:07:12 AM »
                                    Thanks for your help, I have now managed to create the batch file BUT the main issue is I neet to connect to user's I drives, approximatelt 200 drives to obtain the information. so this is what the objective is.......Run batch file  to connect to I:\servername\username$ ......obtain list of jpeg on this drive .....copy on text file on my C:\drive.
                                    I have around 200 different username$ to connect to on five different servernames.

                                    Please assist as your previous input has been very helpful. Thanks to all.

                                    navin

                                      Topic Starter


                                      Greenhorn

                                      Re: Creating batch file
                                      « Reply #28 on: September 17, 2008, 01:08:16 AM »
                                      Hi guys thanks for your help,

                                      I really want to access user's homes drives to obtain the information, the objective is:
                                      use batch file to connect to user's home drive: \\servername\username$
                                      copy information on all jpeg files on a text file and return to me on my home drive.
                                      There are approximately 200 users on five different servers.
                                      All your help is appriciated. Thanks