recursively search C: for specific file-type type then copy w/Path

Page 1 of 2 12 LastLast

  1. Posts : 233
    Win 10 Ver 1903
       #1

    recursively search C: for specific file-type type then copy w/Path


    Pretty much what it says in the Header. I am sure this can be done using the correct switched in several tools like robocopy or even X-Copy but so far copying the file including its full path to another location is not working properly for me.
    I think i have the recursive part working but the files i am looking for are all in hidden or system folders. To be specific, all the *.ACL files. I would like to have a copy of each located in its current full path in another folder for a project I am working on. I have a number of tools that can easily find them all. Ultrasearch is great for that. But nothing allows me to copy all 30 of them with their full paths to another folder.
      My Computer


  2. Posts : 13,301
    Windows 10 Pro (x64) 21H2 19044.1526
       #2

    Have you tried a program called "search everything" or just "everything"
    its listed under other on

    Ninite - Install or Update Multiple Apps at Once
      My Computers


  3. Posts : 14,051
    Windows 11 Pro X64 22H2 22621.1848
       #3

    You copy files, you don't copy paths, so your question doesn't really make sense, at least not to me.
    You can create a list of files with their full paths and save that as a .txt or.csv file but that's all I can think of that you can do to preserve the path.
      My Computers


  4. Posts : 233
    Win 10 Ver 1903
    Thread Starter
       #4

    It Kills e that this is something i have done before but simply cannot remember the correct steps. If they ever meed a volunteer to be the first one to have the consciousness downloadable into a computer I want to know where to sign up/
    I will post back here shortly witty the code
      My Computer


  5. Posts : 456
    Windows 10
       #5

    It is done with robocopy.

    Let's say you want to copy all *acl files in c:\ with path to D:\ACL:

    robocopy c:\ d:\ACL *.acl /s /ndl /xj

    c:\ = source
    d:\ACL = destination
    *.acl = Pattern of files to copy
    /s = Include subfolders except empty ones
    /ndl = No Directory Listing
    /xj = Exclude Junctions

    Let's say you don't want to copy you only want a listing with all *acl files and save it in a text file:
    Code:
    robocopy c:\ D:\ACL *.acl /njh /njs /np /nc /ns /s /ndl /xj /fp /l /log:D:\log\log.txt
    
    /njh = No Job Header
    /njs = No Job Summary
    /np = No Progress
    /nc = No classes
    /ns = No size
    /fp = Show full path
    /l = List only (shows only what would be copied)
    /log = Path to the log file
      My Computer


  6. Posts : 1,264
    W10-Pro 22H2
       #6

    I know there is a Robocopy answer, but, since I use a similar command to backup my data nightly using just xcopy, I thought I'd try to tweak it: the following line does it:

    xcopy "%1:\*.acl" %2:\acl_files\ /s/c/d/i/y/h

    called with 'x.bat c d' where c is obvious and d is a drive letter you want to copy to. This re-creates the folder structure on d for any acl files it finds - I had to add /h as without that it failed to copy files in the users folder (but managed \windows and \program_files). You can change 'd' to be a specific folder, of course.

    hth, Martin
      My Computer


  7. Posts : 989
    Microsoft Windows 10 Home
       #7

    For comepletenees, the PowerShell version:
    Code:
    $dest = 'C:\USers\Keith\Sandbox'
    gci *.ACL -force -recurse -ea silent |
        copy-item -destination {
          $destpath = join-path $dest ($_.Directory.Fullname -replace ':')
          If (!(test-path $destpath)) {new-item $destpath}
          join-path $destpath $_.Name
       } -whatif
    The code as posted (-whatif) won't actually perform the copy, just echo what operations it would perform. If the output describes the behavior you want, remove the '-whatif'

    Keith
      My Computer


  8. Posts : 14,051
    Windows 11 Pro X64 22H2 22621.1848
       #8

    @mngerhold, so what you want to do is copy one or more specific files from one or more folders on one drive to the same folder structure on another drive. Sorry, that is not what I understood your question to be.

    Glad you have several answers that will work for you.
      My Computers


  9. Posts : 233
    Win 10 Ver 1903
    Thread Starter
       #9

    WOW guys. Thanks to Everyone!

    Today is Mothers day and both daughters are gone from home. One is in the Military serving overseas. I got busy trying to come up with a nifty Family Mothers Day surprise for the Wife.. I never did find the code I wanted and what you have given me is More than adequate. Better than what i had :)

    I often like to try changes in specific files and want to be able to have more than a folder list of how things were before i started.
    The original file stored in its original location is perfect backup for things like this. With the info you provided i can also see other possible uses and I appreciate all of it
      My Computer


  10. Posts : 233
    Win 10 Ver 1903
    Thread Starter
       #10

    ricardobohner:
    I cant get the version with the log to work? Says something wrong with the parameters? Doesn't like "/log:\log\log.txt.
    i am trying to locate the glitch but you used so many switches i am unfamiliar with.. Any idea what i am doing wrong?

    Seems i am not having a good day. KeithM, the PS version runs with no errors but the 31 ACL files are not copied to anywhere as far as i can see. I created the identical path with my username and sandbox folder in it.?
    More interesting by the minute. Even the first robocopy option fails. Or rather it runs, but when done nothing has been copied to anywhere. Even though robocopy reports that it has been, more than just opne or two files also, it reports the complete number of directories it had to create in order to run at all.
    Since the only file at the end of the path is a single .acl file that should be an impressive stack While running everything looks fine. When done, the drive it copied to is totally empty. Even the ACL folder which i created on it manually just in case I had to is now gone.
    The drive has NTFS formatting. The command is run under cmd prompt opened as admin.
    I guess this wasn't meant to be
    I can test it with other type file extensions as ACL's are technically something that probably should not be copied anyway.
    Last edited by questorfla; 12 May 2019 at 18:56. Reason: added info
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:44.
Find Us




Windows 10 Forums