Batch File rookie with an idea
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 28

Thread: Batch File rookie with an idea

  1. #1
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051

    Batch File rookie with an idea

    I don't know DOS enough to make the batch file I want to make. What I want to do is make a batch file that I can modify the variables on that can find, then copy, and then paste files to a new directory and a new drive. The reason I need to know the variables is because I want to be able to modify it for situations such as a client wanting me to find and move files for them and rather than do a search then copy and paste I'd prefer to just run a batch file so I can focus on other tasks. In addition to that I am sure I could modify the variables of what file/file type to find, and where to send it for things such as repairs also and probably other tasks when they arise. I already found one someone posted online on another site that details how to do a search and delete batch file but I don't know enough to edit this for my find, copy, and paste.
    One Script to rule them all.
    One Script to find them.
    One Script to bring them all,
    and clean up after itself.

  2. #2
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    Thing about dos batch files is that you have to work in 8.3

    Now I assume you want to tell it to go look for all docs or pics or whatever and copy them to another drive? The question is, do you want to preserve the folder structure in which they are found?

    You might be better off with robocopy...

  3. #3
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    At this point folder structure isn't really important. At the moment I just want to make something that can do a search, copy and paste. I intend to modify it to the needs of my virus removal and recovery of core system files when the system won't allow me to because of the infection stopping me and so on. I'm trying to remove myself of the need to plug their drive into a computer as much as possible to reduce time and costs with travel. And might attempt using such in remote assistance.

  4. #4
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    how about you post some proposed searches?
    Would you be searching for say all *.doc* on a machine?

  5. #5
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    correct the search would be similar to this setup. I am using general file names just for sake of the explanation of what i want to do.

    Find *.pst
    Copy *found results* to g:\recovered data

    The other setup I was going to do for replacements would have been

    find *.pst
    copy and replace *found results* to g:\recovered data

    my biggest hurdle is not knowing the command for copying what was found in the search or even knowing the syntax to set that up.

  6. #6
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    OK, well you need the for command...

    for /r c:\ %X in (*.pst) do (copy %X D:\test\*.*)

    If you want to put this in a batch file the %X must be written as %%X - the line above is for you to try out on a command line box - obviously you need to alter the drive letters to suit you.

  7. #7
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    Cool thanks NooNoo I appreciate the input on that. As a side note my buddy showed me a command to use which I have yet to test for just find and copy which is "xcopy C:\*.pst /S D:\backup"

  8. #8
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    careful with xcopy - the wrong version will have an interesting effect and it has a problem with long file/path names too.

    Also ran your code,

    And got

    C:\Users\XXX>xcopy C:\*.pst /S D:\test\*.*
    File not found - *.pst
    0 File(s) copied

    Which took a long time to come to that decision

  9. #9
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    Ew well that's not cool. Thanks for the heads up on that I don't want a faulty tool to rely on.

  10. #10
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    It's not faulty, it just has several versions....

  11. #11
    Registered User CeeBee's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    2,494
    roocopy

  12. #12
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    Quote Originally Posted by CeeBee View Post
    roocopy
    Is that the jumped up version of robocopy?

  13. #13
    Registered User CeeBee's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    2,494
    Quote Originally Posted by NooNoo View Post
    Is that the jumped up version of robocopy?
    no, it's the typo version

  14. #14
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    roo... kangaroo....jumped.... get it? Nevermind....

  15. #15
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    Quote Originally Posted by NooNoo View Post
    roo... kangaroo....jumped.... get it? Nevermind....
    Perhaps if you had called it the "hopped up version" he'd have seen the pun. Also don't you have to install robocopy? I'd prefer not to have to install then uninstall software for this. Thanks for the suggestion though.

Similar Threads

  1. Follow on from Ipconfig batch file: CMD prompt not working
    By clarinathan in forum Tech-To-Tech
    Replies: 7
    Last Post: December 16th, 2010, 09:48 PM
  2. Create a batch file for drive/print mapping
    By Irish Shark in forum Windows Server 2003 & Windows Home Server
    Replies: 1
    Last Post: June 15th, 2008, 03:41 PM
  3. Batch file help
    By Master Frodo UK in forum Programming And Web Design
    Replies: 1
    Last Post: August 21st, 2006, 10:34 AM
  4. Batch File Help
    By xazo in forum DOS
    Replies: 2
    Last Post: November 14th, 2005, 10:16 PM
  5. Batch file to print only 33 lines
    By oldsaltydog in forum Digital Imaging
    Replies: 3
    Last Post: May 31st, 2005, 05:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •