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 12507 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?