wasabi3689
asked on
how to copy files based on a file to a locaiton
I have a flat file named "Outflatfile.txt, the format like below
ABC|\\rootsql\Documents\re wrerwerwe. doc
cfg|\\rootsql\Documents\re wre234erwe .doc
AGC|\\rootsql\Documents\re wre321rwe. doc
cfK|\\rootsql\Documents\re erewre234e re.doc
.....
etc
Now I want to copy all the file based on the directory specified "\\rootsql\Documents" to a new location, let's \\newhome\documents
How to do that?
ABC|\\rootsql\Documents\re
cfg|\\rootsql\Documents\re
AGC|\\rootsql\Documents\re
cfK|\\rootsql\Documents\re
.....
etc
Now I want to copy all the file based on the directory specified "\\rootsql\Documents" to a new location, let's \\newhome\documents
How to do that?
ASKER
how to log the copying?
ASKER
It doesn't work. I have this returned
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Start Time: Wed 03/15/2017 9:51:06.85
The system cannot find the path specified.
Finish Time: Wed 03/15/2017 9:51:06.88
Press any key to continue . . .
Here is the
for /f "tokens=1* delims=|" %%a in ('type "\\mysql3\Outflatfile.txt" ') do (
copy "%%b" "\\newhome\documents"
pause
)
Actually,
to read file location is \\mysql3\Outflatfile.txt
source files from location \\rootsql\Documents\
destination location \\newhome\documents
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Start Time: Wed 03/15/2017 9:51:06.85
The system cannot find the path specified.
Finish Time: Wed 03/15/2017 9:51:06.88
Press any key to continue . . .
Here is the
for /f "tokens=1* delims=|" %%a in ('type "\\mysql3\Outflatfile.txt"
copy "%%b" "\\newhome\documents"
pause
)
Actually,
to read file location is \\mysql3\Outflatfile.txt
source files from location \\rootsql\Documents\
destination location \\newhome\documents
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I still have this error
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Start Time: Wed 03/15/2017 17:13:12.46
The system cannot find the file specified.
Press any key to continue . .
How to troubleshoot that? .
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Start Time: Wed 03/15/2017 17:13:12.46
The system cannot find the file specified.
Press any key to continue . .
How to troubleshoot that? .
ASKER
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
Press any key to continue . . .
The system cannot find the file specified.
> How to troubleshoot?
- Review FNLog. It shows the filenames.
- Disable @echo off at line 1. Then run it again.
- Review FNLog. It shows the filenames.
- Disable @echo off at line 1. Then run it again.
ASKER
I see these from log
1 copy "PDF" "\\testsql\NGProduction\NG FinalDocs\ Documents2 "
1 copy "PDF" "\\testsql\NGProduction\NG FinalDocs\ Documents2 "
1 copy "PDF" "\\testsql\NGProduction\NG FinalDocs\ Documents2 "
1 copy "PDF" "\\testsql\NGProduction\NG FinalDocs\ Documents2 "
1 copy "PDF" "\\testsql\NGProduction\NG FinalDocs\ Documents2 "
can you tell what went wrong?
1 copy "PDF" "\\testsql\NGProduction\NG
1 copy "PDF" "\\testsql\NGProduction\NG
1 copy "PDF" "\\testsql\NGProduction\NG
1 copy "PDF" "\\testsql\NGProduction\NG
1 copy "PDF" "\\testsql\NGProduction\NG
can you tell what went wrong?
I can guess it's having issues with the filenames in Outflatfile.txt.
Post a sample of the lines in Outflatfile.txt
Post a sample of the lines in Outflatfile.txt
ASKER
Here is the sample lines
PDF|\\testsql\NGProduction Docs\NGSou rceDocs\Do cuments2\2 FD58F4B-57 A2-4F88-A3 B4-02CD826 3B2C8.doc
PDF|\\testsql\NGProduction Docs\NGSou rceDocs\Do cuments2\A 7D10A14-98 25-4C98-A4 93-03CD07E 77A54.doc
PDF|\\testsql\NGProduction Docs\NGSou rceDocs\Do cuments2\F 7AF2932-E9 F6-4292-80 28-BC617EC F982F.doc
PDF|\\testsql\NGProduction
PDF|\\testsql\NGProduction
PDF|\\testsql\NGProduction
ASKER
I fix this issue. But, I need help to update your script
So far, I have to press enter key to copy one by one file to destination folder. How do I avoid the enter key to press when program runs?
So far, I have to press enter key to copy one by one file to destination folder. How do I avoid the enter key to press when program runs?
Remove the PAUSE on line 15
Open in new window