Saved Bookmarks
| 1. |
Solve : Folder Transfer Batch File? |
|
Answer» Quote from: Law506 on August 01, 2008, 09:43:09 PM What command would I throw into the batch file to have it OUTPUT in the text file how many FOLDERS it moved? echo off cls echo -------------------------------------------------------------------------------------------------------- >>Transfer.txt date /t >>Transfer.txt time /t >>Transfer.txt echo This will transfer all folders in SCAN to the ALPHABETICAL SCANNED DOCUMENTS. echo To stop the process CLOSE this window. echo LIST of Files Moved. >>Transfer.txt pause setlocal enabledelayedexpansion set Source=C:\Scanned Documents\ set Target=C:\Alphabetical Scanned Documents\ set /a foldersmoved=0 for /f "tokens=*" %%a in ('dir "%Source%" /ad /b') do ( set Current=%%a xcopy "%Source%\%%a" "%Target%\!Current:~0,1!\%%a\" /S /D /Y /C >>Transfer.txt set /a foldersmoved=!foldersmoved!+1 ) echo End Of Copy, see Transfer.txt for list of moved files. echo End Of Copy. >>Transfer.txt echo Folders moved: %foldersmoved% >> Transfer.txt pauseAwesome, works like a charm just like I expected. Thanks Again. Quote from: Law506 on August 01, 2008, 09:43:09 PM hey, for /f "tokens=*" %%a in ('dir "%Source%" /ad /b') do ( set Current=%%a xcopy "%Source%\%%a" "%Target%\!Current:~0,1!\%%a\" /S /D /Y /C >>Transfer.txt If %ERRORLEVEL%==0 ( GOTO :EOF ) else ( Echo The following file completed with %errorlevel% >> errorlog.txt ) )what "following file"? Can't quite see how the filename gets echoed. Quote from: Dias de verano on August 03, 2008, 09:00:02 AM what "following file"? Can't quite see how the filename gets echoed. Sorry should have read "following %%a"but the dir /ad in the loop makes %%a a folder, not a file. Quote from: Dias de verano on August 03, 2008, 10:49:18 AM but the dir /ad in the loop makes %%a a folder, not a file. Yes you are CORRECT again. My bad for not reading the script carefully, I guess I was focused on the script that I posted and remember that the search was for .pdf's. No I didn't make the assumption that the only files in any folder would be PDF's. But thanks again for pointing out my short sightedness DIAS. |
|