Saved Bookmarks
| 1. |
Solve : move files where filenames are not having extensions? |
|
Answer» I have a list of file names in File.txt, where they look like 'x yz.doc', 'ab c.doc' the below code is working only if they are WRITTEN like this 'x yz.doc.docx', 'ab c.doc.docx' in File.txt. Is there any way to make the below PROGRAM work for the list having 'x yz.doc', 'ab c.doc'?? Please help.. echo off set old=c:\InPut set new=c:\OutPut REM create a text file for log purpose for the files which missed moving echo Files not having DB entries > Missed.txt echo --------------------------------- >> Missed.txt for /f "delims= skip=1" %%G in (File.txt) do ( if EXIST %old%\%%G ( MOVE %old%\%%G %new%\ ) else echo %%G >> Missed.txt ) pauseSorry I can not help. For the benefit of others, here is a reference to the skip options and some other things about the FOR command. http://ss64.com/nt/for_f.htmlTo be sure that file handling code will correctly work with paths and file names that may have spaces, enclose them in QUOTE MARKS. This applies generally. Code: [SELECT]for /f "delims= skip=1" %%G in (File.txt) do ( if EXIST "%old%\%%G" ( move "%old%\%%G" "%new%\" ) else echo %%G >> Missed.txt ) |
|