Saved Bookmarks
| 1. |
Solve : finding/moving files? |
|
Answer» Good Morning Good MorningHi Did you mean move or copy them in NEW folder ?To copy pleaseHi You can give a try with this batch file : CopyPDF.bat Just copy and paste this code with your NOTEPAD and save it as CopyPDF.bat and just drag and drop your folder on it. Code: [Select]echo off Title Copying All PDF files in folder and its subfolders with drag and drop Mode con cols=75 lines=3 & color 0E set "Drag_Dir=%~1" set "Ext=pdf" echo( IF ["%Drag_Dir%"] EQU [""] Goto:Error set "newFolder=%Drag_Dir%\New_%Ext%_Folder" Rem Create the new folder to copy all *.pdf on it If not exist "%newFolder%" md "%newFolder%" 2>nul cd "%newFolder%" && Call :CopyPDFfiles || Goto:Error EXplorer "%newFolder%" Exit ::******************************************** :CopyPDFfiles for /f "delims=" %%I in ('Dir /a-d /b /s "%Drag_Dir%\*.%Ext%"') do ( Copy /Y "%%I" "%newFolder%" ) Exit /b ::******************************************** :Error Mode con cols=75 lines=5 & Color 0C echo( ECHO You must drag and drop a folder on this batch program ECHO to copy all PDF files in new location Timeout /T 10 /NoBreak >nul Exit /b ::*****************************************Thank you Hacko. It created the folder but no pdf's inside it. Quote from: widetree on April 20, 2017, 07:41:51 AM It created the folder but no pdf's inside it.Check if your folder and its subfolders contains any pdf files or not ! if the batch file dosen't find any pdf files it create an empty folder named New_PDF_FolderYes that worked beautifully! Thank you very much! Could you possibly tweet the code so I could run this batch file to find pdf's with a name containing the characters "plan"? Quote from: widetree on April 20, 2017, 08:13:16 AM Yes that worked beautifully! Thank you very much! Could you possibly tweet the code so I could run this batch file to find pdf's with a name containing the characters "plan"?Here we go Code: [Select]echo off Title Copying All PDF files in folder and its subfolders with drag and drop Mode con cols=75 lines=3 & color 0E set "Drag_Dir=%~1" set "Ext=pdf" set "Word=plan" IF ["%Drag_Dir%"] EQU [""] Goto:Error set "newFolder=%Drag_Dir%\New_%Ext%_Folder" Rem Create the new folder to copy all *.pdf on it If not exist "%newFolder%" md "%newFolder%" 2>nul cd "%newFolder%" && Call :CopyPDFfiles || Goto:Error Explorer "%newFolder%" Exit ::******************************************** :CopyPDFfiles for /f "delims=" %%I in ('Dir /a-d /b /s "%Drag_Dir%\*.%Ext%" ^| find /I "%Word%"') do ( Rem find all pdf's with a name containing the characters "plan" and copy them to the newfolder Copy /Y "%%I" "%newFolder%" ) Exit /b ::******************************************** :Error Mode con cols=75 lines=5 & Color 0C echo( ECHO You must drag and drop a folder on this batch program ECHO to copy all PDF files in new location Timeout /T 10 /NoBreak >nul Exit /b ::*****************************************That worked too! Thank you so much! I did not realise so much coding was involved. Quote from: widetree on April 21, 2017, 12:14:51 AM That worked too! Thank you so much! I did not realise so much coding was involved.You are welcome dude and don't forget to use the Thanks LINK Have a nice day ! |
|