Jump to content

Recommended Posts

Posted

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?

Posted

robocopy options chudu...andulo undochu..

Posted
@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
Posted

Powershell lo inka simple code:

$sourceFolder = "D:\source"
$destinationFolder = "D:\copiedfiles"
$maxItems = 200
Get-Childitem $sourceFolder | Select-Object -First $maxItems | Copy-Item $destinationFolder
Posted


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
Posted

Single command tho aye chance leda baa

Posted

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

Posted

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 

Posted

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
×
×
  • Create New...