meranaam Posted May 5, 2015 Report Posted May 5, 2015 Folder1 lo 100 files unnayi..filaname pattern: filexxx.txt Folder2 lo ki 10 files copy cheyali using a DOS command..move command ki options emana unnaya to define how many files to copy ani?
Spartan Posted May 5, 2015 Report Posted May 5, 2015 @echo off setlocal enableextensions enabledelayedexpansion set "source=d:\temp\input" set "target=d:\temp\output" set num=10 for /F "tokens=1,2 delims=:" %%f in ('dir /b /a-d "%source%\*" ^| findstr /n "^" ') do ( if %%f leq %num% ( copy "%source%\%%g" "%target%" /y > nul ) else goto endCopy ) :endCopy endlocal
Spartan Posted May 5, 2015 Report Posted May 5, 2015 Powershell lo inka simple code: $sourceFolder = "D:\source" $destinationFolder = "D:\copiedfiles" $maxItems = 200 Get-Childitem $sourceFolder | Select-Object -First $maxItems | Copy-Item $destinationFolder
meranaam Posted May 5, 2015 Author Report Posted May 5, 2015 Powershell lo inka simple code: $sourceFolder = "D:\source" $destinationFolder = "D:\copiedfiles" $maxItems = 200 Get-Childitem $sourceFolder | Select-Object -First $maxItems | Copy-Item $destinationFolder Edi try chesi chusta
meranaam Posted May 5, 2015 Author Report Posted May 5, 2015 Command: Find abc*.txt | head -n 1 Aa above command wil give me a file name with that pattern.. Aa cmnd nunchi vache result ni oka varaiable lo ki ela save chestam baa in DOS
puli_keka Posted May 5, 2015 Report Posted May 5, 2015 Command: Find abc*.txt | head -n 1 Aa above command wil give me a file name with that pattern.. Aa cmnd nunchi vache result ni oka varaiable lo ki ela save chestam baa in DOS unix lo unnattu just command lo piping kashtam .. batch file or powershell dikku
meranaam Posted May 5, 2015 Author Report Posted May 5, 2015 unix lo unnattu just command lo piping kashtam .. batch file or powershell dikku Even without piping of commands..lets say find abc.txt ane cmnd result ni oka variable lo ki store cheyadaniki ila usng baa Set filename=find c:\abc.txt Echo %filename% ante result lo ki "find c:\abc.txt" ani vastundi rather than cmnd result
puli_keka Posted May 6, 2015 Report Posted May 6, 2015 Even without piping of commands..lets say find abc.txt ane cmnd result ni oka variable lo ki store cheyadaniki ila usng baa Set filename=find c:\abc.txt Echo %filename% ante result lo ki "find c:\abc.txt" ani vastundi rather than cmnd result http://www.sidesofmarch.com/index.php/archive/2004/03/30/using-the-for-command-to-copy-files-listed-in-a-text-file/ not exactly but might give you idea
Recommended Posts