![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | file copy operations using source file input and script? we have a text file that contains a full directory listing of a given drive's folder structure, this text file directory list represents the same path structure (drive letter, etc.) the OS is able to see ( external USB drive), I want to use that text file to provide a copy utility (xcopy, xxcopy, robocopy, ?) with the source folder path for a file copy operation to execute upon, so the copy utility will perform a copy operation on the first directory path provided in the text file, then the next and so on recursing down the list, note that the copy operation will copy only files that are in a given directory path, no subdirectories, and the destination folders for the copy operations will maintain the source directory path (source E:\path1\file1 to destination Q:\path\1\file1) OPTION A I know that we could script the operation with say PowerShell and a simple copy utility but if I can find a copy utility that supports the 'input file' natively perhaps that will be easier then writing the script OPTION B write a script (Powershell script) that will parse the 'input file' and run the command line copy operation, whatever the copy utility may be (xcopy, xxcopy, robocopy, ?) QUESTIONS 1.) does anyone know of a copy utility that natively supports executing operations using an 'input file' like this 2.) does anyone want to give direction on writing the script, I am liking the idea of using Windows PowerShell and a GUI front end tool to aid in the process (PowerGUI, PowerShell Analyser, etc.) |
My System Specs![]() |
| | #2 (permalink) |
| Member | Re: file copy operations using source file input and script? Why not try something like this? cat pathfile.txt | %{ Copy-Item $_ c:\destination\} |
My System Specs![]() |
| | #3 (permalink) |
| Guest | RE: file copy operations using source file input and script? @' E:\path\1\file1.ext E:\path\1\file2.ext E:\path\1\file3.ext E:\path\1\file4.ext E:\path\1\file5.ext E:\path\2\file.ext E:\path\2\file2.ext E:\path\2\file3.ext E:\path\2\file4.ext E:\1\path\1\file1.ext E:\1\path\1\file2.ext E:\1\path\1\file3.ext '@ > listing.txt # before tree E:\path /f /a tree c:\path /f /a tree E:\1 /f /a tree c:\1 /f /a # this assumes that the paths in listing.txt are valid and point to an # existin file $root = 'E:\\' $destRoot = 'C:\\' gc listing.txt | % { $dest = $_ -replace $root, $destRoot $parent = split-path $dest if (!(test-path $parent)) {ni $parent -i d* -vb} cpi $_ $dest -vb } # after tree E:\path /f /a tree c:\path /f /a tree E:\1 /f /a tree c:\1 /f /a -- Kiron |
My System Specs![]() |
| | #4 (permalink) |
| Member | Re: file copy operations using source file input and script? That's a good looking script! I have never used the tree application before. You know, if you don't use the /a switch it looks really nice in the powershell console: PS D:\> tree test Folder PATH listing Volume serial number is ####-#### D:\TEST ├───dir1 ├───dir2 └───dir3 PS D:\> tree test /a Folder PATH listing Volume serial number is ####-#### D:\TEST +---dir1 +---dir2 \---dir3 |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: file copy operations using source file input and script? Hi Eric, You're absolutely right, my mistake. I use Consolas for the console and the extended characters are not supported, should have removed that switch. Thanks! -- Kiron |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Windows Explorer crashes when performing file operations | Vista file management | |||
| File operations | Vista General | |||
| how to read input file of DN's and perform operations on them? | PowerShell | |||
| Slow file operations and cannot use ViceVersa | Vista file management | |||
| Slow file operations and cannot use ViceVersa | Vista file management | |||